|> > I am using random()&01 to get a binary random
|> > number. Turns out if I generate more than 50 numbers,
|> > the last 30 or more are all 1s or 0s, i.e., my random
|> > number generator is not random!
|> The FAQ for comp.lang.c has a section on just that.
|> Basically the standard random number generator is good
|> at generating random numbers in general, but if you extract
|> just the low bit the result is, as you found out, less than
|> random. You may try to look at a different "bit" from
|> the result.
Most people replying to the original article seem to think that badri
was using rand when in fact he is using random. The man page for random
The difference is
that rand(3V) produces a much less random sequence - in
fact, the low dozen bits generated by rand go through a
cyclic pattern. All the bits generated by random() are
usable. For example,
will produce a random binary value.
Are you saying that this statement is fertilizer?
Ericsson Telecom AB