06-13-2017 03:38 AM
I'm trying to build for developing some random values. So I took some array of data which was stored before and i want to change those values continuous values which should be in +-5% tolerance band.
for ex: Array- 10,20,30,40,50
I need the output as +-5% from the above values. Can anyone help me out with some suggestions?
Solved! Go to Solution.
06-13-2017 04:14 AM
Tools you need:
- For Loop which iterates as often as you have elements in your array (array size)
- Random Number to get a random number between 0 and 1. Scale the number to a value between -0.05 and +0.05. Inside the loop
- Add the scaled random number to 1. Use an indexing tunnel to create an array with numbers between 0.95 and 1.05
- Multiply the original array with the random number array
06-13-2017 06:03 AM - edited 06-13-2017 06:03 AM
Like this?
06-14-2017 02:29 AM
What if it's a 2D array?
06-14-2017 03:25 AM
Then you have to nest the for loop in another for loop. The array size of the original array is giving you the numbers of rows and columns so you know how often each of the loop has to run.