random number generation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

random number generation

Salvador Alcaraz

Hello, friends, from Spain:

I am using  random module and export functions

seed/0
uniform/0


I need to initialize same process with diferent seeds.

Should I have to use random:seed/3 function???

seed(A1,A2,A3) -> ran()


Which is the meaning of A1, A2 , A3 parameters??


Thank you in advance


_________________________________________________
Salvador Alcaraz Carrasco
Division de Ingenieria Telematica
Dpto. de Fisica y Arquitectura de Computadores
Universidad Miguel Hernandez

salcaraz
http://obelix.umh.es
__________________________________________________



Reply | Threaded
Open this post in threaded view
|

random number generation

Robert Virding-4
The seed to the random number generator actually consists of three
(positive) numbers.  These can be set to the default values using
seed/0 and to specific numbers using seed/3.  Both functions return
the current seed.

There is no specific meaning the A1, A2, and A3 parameters, they are
just three numbers which together make the seed.  If you want to
(re-)initialise a processes' seed to set (different) values then
you must use seed/3.

        Robert

Salvador Alcaraz <salcaraz> writes:

>
>Hello, friends, from Spain:
>
>I am using  random module and export functions
>
>seed/0
>uniform/0
>
>I need to initialize same process with diferent seeds.
>
>Should I have to use random:seed/3 function???
>
>seed(A1,A2,A3) -> ran()
>
>Which is the meaning of A1, A2 , A3 parameters??
>
>
>Thank you in advance
>
>
>_________________________________________________
>Salvador Alcaraz Carrasco
>Division de Ingenieria Telematica
>Dpto. de Fisica y Arquitectura de Computadores
>Universidad Miguel Hernandez
>
>salcaraz
>http://obelix.umh.es
>__________________________________________________


Reply | Threaded
Open this post in threaded view
|

random number generation

Ulf Wiger-4
On Wed, 6 Jun 2001, Robert Virding wrote:

>There is no specific meaning the A1, A2, and A3 parameters, they are
>just three numbers which together make the seed.  If you want to
>(re-)initialise a processes' seed to set (different) values then
>you must use seed/3.

A handy way of doing this is of course:

new_seed() ->
   {A1,A2,A3} = erlang:now(),
   random:seed(A1,A2,A3).


/Uffe

--
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB