Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Random CGI

From: chris:starforge at: 4-Feb-2001 10:18

#04-Feb-01# Message from *Terry Brownell*: Hi Terry,
> The problem is, it always picks the same number regardless?
Before you use *any* sort of random number generator you need to set the seed value. random probably has a built-in, fixed value default which is fine if you need a single run of "somewhat random" values (I doubt that random uses a decent quality linear congruence or subtractive method algorithm so don't expect it to be random over long periods) but if you need to do several "one off" random numbers you should either: - write a function that takes the current time, plays with it a bit and returns a value you can use. - call random/seed now before calling random (more or less the same as the first option really) If you need something "very" random (ie: not related to the time in any way) then you'll need to use a seed store on the server and load and save the seed for each session... Chris -- New sig in the works Explorer 2260, Designer and Coder http://www.starforge.co.uk -- Cleanliness is next to impossible.