Getting a *more* random value

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Wed Mar 29 10:04:33 CEST 2006

Random has a hard-coded default seed. That's 
why you get the same series for each run.

Calling e.g.

{I1,I2,I3} = erlang:now(),

would give you a new series each time.

Ulf W 

> -----Original Message-----
> From: owner-erlang-questions@REDACTED 
> [mailto:owner-erlang-questions@REDACTED] On Behalf Of Pupeno
> Sent: den 29 mars 2006 01:41
> To: erlang-questions@REDACTED
> Subject: Getting a *more* random value
> Hello.
> I have an application where new processes are launched which 
> calculate one random number between 0 and 512 and then do 
> something with that number and terminate.
> I am currently using random:uniform(513) - 1 but that gives 
> me the same random value for all the processes for each run 
> of the application. I see that consecutive calls would get 
> other numbers but I only need one.
> How am I supposed to get a number that is not the same on 
> every process ?
> Thank you.
> --
> Pupeno <pupeno@REDACTED> (

More information about the erlang-questions mailing list