03-17-2015 02:37 PM
How to generate random binary number "16 bits" ?
Solved! Go to Solution.
03-17-2015 02:40 PM
03-17-2015 02:44 PM
But it cannot be binary .. I changed it to be unsigned 16 bit inside a loop with constant counter = 15 to be looped 16 times but I got 4 bits I don't know why ! Any Idea ?
03-17-2015 02:52 PM
03-17-2015 02:58 PM
here is the VI
03-17-2015 03:03 PM
03-17-2015 03:13 PM
If you are asking to have a random unsigned 16bit integer, this will do the trick
03-17-2015 03:14 PM
Thank you
03-17-2015 03:14 PM
Thank you
03-17-2015 03:33 PM - edited 03-17-2015 03:35 PM
Bowen's example will have a slight bias towards zero in any give bit because when the random number is exactly 0.5, it will round down to zero instead of up to 1. (random number range is 0 to .99999.....)
Awang's example is not very good either, actually worse, because it will have a bias away from 0 and 65535 happening about 1/2 as often as the other numbers because the way it rounds to nearest.
The proper implementation is to multiply by 65536, then round down.