# LabVIEW

cancel
Showing results 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.

Note;

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

Message 1 of 8
(2,208 Views)

## Re: How to create a random incremental number

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

Message 2 of 8
(2,205 Views)

## Re: How to create a random incremental number

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

Some ideas:

Message 3 of 8
(2,194 Views)

## Re: How to create a random incremental number

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

Message 4 of 8
(2,159 Views)

## Re: How to create a random incremental number

Integral x(t) PtByPt.vi:

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

Message 5 of 8
(2,112 Views)

## Re: How to create a random incremental number

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...

Redhawk
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.

Message 6 of 8
(2,098 Views)

## Re: How to create a random incremental number

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

Message 7 of 8
(2,095 Views)

## Re: How to create a random incremental number

Or loop-free ... 😉

Message 8 of 8
(2,060 Views)