Mailing List Archive

rand() vs. random()
I just built perl5 on a Solaris2.4 box. Configure decided that rand() only
has 15 bits. (SunWorks 3.0 cc).

Could someone explain:

. Is this a critical issue. Somehow having more random digits and
a longer cycle seems better.

. Is it a problem to rebuild with -Drand=random -Dsrand=srandom ?

. If this redefinition is not a problem, should Configure look for
random and offer it instead?

. (The $64 question. Why did the transition to Solaris lose?)

<chaim>
Re: rand() vs. random() [ In reply to ]
On Wed, 13 Dec 1995, Chaim Frenkel wrote:

> I just built perl5 on a Solaris2.4 box. Configure decided that rand() only
> has 15 bits. (SunWorks 3.0 cc).
>
> Could someone explain:
>
> . Is this a critical issue. Somehow having more random digits and
> a longer cycle seems better.

- If you really need a random number generator, neither rand or random
is worth spit... Okay for games, but that's about it. Drand48 is better
spectrally, okay for simulations but not good enough for cryptography.

>
> . Is it a problem to rebuild with -Drand=random -Dsrand=srandom ?
>

- Not really, if Solaris has a random and srandom. They are "bsd" system
calls.

> . If this redefinition is not a problem, should Configure look for
> random and offer it instead?
>

- I think it has to do with the order in which libraries get searched. I
don't have a solaris box handy to test. From the last time I looked into
this I think the configure script "prefers" rand over random. Probably a
choice of getting perl to work on more systems. There's not enough difference
in the quality of the two algorithms to lose much sleep over which one
gets picked.


> . (The $64 question. Why did the transition to Solaris lose?)
>

- Solaris is sysv based..... %-) !

- Booker C. Bense : bbense@networking.stanford.edu