LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a random number in LabWindows 5.5

hi louis,

I was wondering if theres a way to limit the random number function to between 1 and 5 as a float value?

like for example i want to generate any random value of float type between 1 and 5

thanks

0 Kudos
Message 11 of 12
(1,255 Views)
For random floats on the range [x, y], try

rand() / (RAND_MAX / (float)(y - x)) + x

Hope this helps.

Mert A.
National Instruments
0 Kudos
Message 12 of 12
(1,250 Views)