ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate Random numbers

Solved!
Go to solution

Single loop solution for strings:

 

ShuffleStrings.png

0 Kudos
Message 11 of 13
(1,114 Views)

Im trying to generate a random number between -10 and 10 and display a LED to display negative values, an LED for the range of 0 to 5, and  an LED for values greater or equal to 5. 

0 Kudos
Message 12 of 13
(1,002 Views)

@jr10 wrote:

Im trying to generate a random number between -10 and 10 and display a LED to display negative values, an LED for the range of 0 to 5, and  an LED for values greater or equal to 5. 


This really should be in its own thread but...

"random number (0-1)", multiply by 20, subtract 10.

Feed the output into a "less than 0" comparison, feed the output of that into an LED.

Feed the output of the subtract 10 into a "greater than" comparison together with "5", feed the output to another LED.

Feed the output of the subtract 10 into an "in range and coerce" together with 0 and 5, feed the output to another LED.

0 Kudos
Message 13 of 13
(982 Views)