Using 'random and 'random/seed
[1/3] from: reboler:programmer at: 22-Aug-2002 14:46
Could someone expound on 'random, please? I would expect that if I entered ... random/seed "qwert" ... that I would nothing back from the console, since I am just providing a seed to the PRNG. 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?
[2/3] 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"
<<quoted lines omitted: 4>>> 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"
>> random/seed 1 >> r2: random "asdfg"
>> equal? r1 r2
== true -jn-
[3/3] from: rebol:optushome:au at: 23-Aug-2002 9:46
Just a note related to random/seed. Core & View start up with the seed set as 1 IOS does not. The seed is not 1 though it is a constant value for scripts launched via the desktop. However if you use CTRL-K to revert to console the random seed will be different each time you launch exe. So what does this mean? Well if you just use random without setting the seed to create a random dynamic layout that you like. That random layout will appear different on IOS (unless you set the same seed). Cheers, Allen K
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted