Showing results for 
Search instead for 
Did you mean: 

How to create a random incremental number


I need help with an issue:
How to create a random incremental number ( eg: 0, 1, 1.5, 2, 2.34, 2.45, ....)
random numbers created within a range , BUT always larger than the previous.


 no not the normal random number generator of 0-1 ,  need values to be random, but rising.


0 Kudos
Message 1 of 8

What have you tried so far?

The requirements seem sparse. You can create an array of random numbers, get them into the range you need, and then sort the 1D array.


We may need more information though. See this guide on how to ask questions that get the information you need: Ask Smart Questions

0 Kudos
Message 2 of 8

What are the inputs? (number of elements, lower range limit, upper range limit)


Some ideas:




0 Kudos
Message 3 of 8

LabVIEW gives you a Random Number generator that gives you values in the range (0, 1).  Let R1 be the first such Random Number.  To get the second, add another U(0, 1) to the previous, i.e. R2 = R1 + U(0,1).  Now R3 = R2 + U(0, 1).  This generates an always-increasing sequence, as you requested.


Bob Schor

0 Kudos
Message 4 of 8

Integral x(t)


Integrate Random.png

Put a wait in the loop... But without the loop the integral will reset each run.

0 Kudos
Message 5 of 8

If you have OpenG Numeric Library, they have a function called Random Number Within Range, and you can easily build out some logic to get the randomness you want...


Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 6 of 8

LV2020 has that. Random Number (Range).vi...

0 Kudos
Message 7 of 8

Or loop-free ... 😉




0 Kudos
Message 8 of 8