[REBOL] Re: Using 'random and 'random/seed
From: joel::neely::fedex::com at: 22-Aug-2002 16:56
Hi, Alan,
alan parman wrote:
> Could someone expound on 'random, please?
>
> I would expect that if I entered ...
>
> random/seed "qwert"
>
The documentation should state what types of values are acceptable
as seeds. I believe that you need to restrict yourself to date!,
time!, or integer! values for legitimate seeds.
> ... that I would nothing back from the console, since I am just
> providing a seed to the PRNG.
>
The fact that you get a value returned appears to indicate that
REBOL ignored your attempt to reseed the generator and used your
value as an argument to RANDOM instead.
> I would also expect that if I entered...
>
> random/seed "qwert"
> r1: random "asdfg"
> random/seed "qwert"
> r2: random "asdfg"
>
> ... that r1 would equal r2.
>
> Is there a way to get 'random to produce identical "random"
> sequences on demand?
>
Seed it with a legal seed.
>> random/seed 1
>> r1: random "asdfg"
== "gafsd"
>> random/seed 1
>> r2: random "asdfg"
== "gafsd"
>> equal? r1 r2
== true
-jn-