[#1026] Is this a bug? — Dave Thomas <Dave@...>

18 messages 2000/01/03

[#1084] Infinite loop — Dave Thomas <Dave@...>

17 messages 2000/01/11

[#1104] The value of while... — Dave Thomas <Dave@...>

24 messages 2000/01/11

[ruby-talk:01065] Re: rand() / drand48()

From: matz@... (Yukihiro Matsumoto)
Date: 2000-01-07 18:58:12 UTC
List: ruby-talk #1065
In message "[ruby-talk:01064] Re: rand() / drand48()"
    on 00/01/07, Andrew Hunt <andy@Toolshed.Com> writes:

|Perl's srand defaults to time(0L), but you can also call
|srand with a constant.

Perl tries /dev/urandom if available.

|I've written a number of programs where I've needed to seed the
|random number generator with a constant in order to get
|a predictable, random stream (as for regression testing).  Other
|times of course, I'd want it to be random.  Process id and
|time shifted around a bit makes a nice default, I think, but
|we still need the ability to seed the generator ourselves.

So, you think it's OK to generate different sequences for each
invocation, iff the mean to suppy seed is available, right?

We already have srand() method to supply seed.
							matz.

In This Thread

Prev Next