espressomd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ESPResSo] random number generator problem


From: Axel Arnold
Subject: Re: [ESPResSo] random number generator problem
Date: Thu, 25 Feb 2010 12:28:21 +0100
User-agent: KMail/1.10.3 (Linux/2.6.27.42-0.1-default; KDE/4.1.3; x86_64; ; )

On Thursday 25 February 2010 07:41:07 BIN ZHANG wrote:
> Hi, there:
>
> I have just started using Espresso, and it's really elegantly
> programmed and easy to use! Great job!
>
> I have just noticed one problem about the random number generator,
> which doesn't seem to be so random. Seems to me calling the function
> init_random() in random.c will generate the same seed every time, and
> thus leads to the same sequence of random numbers. This will lead to
> exactly the same trajectory, which is bad for collecting statistics.
>
> Is there any particular reason for this, or I'm just misunderstanding
> something?

Hi,

the init_random is really just for initializing, in case you don't set your 
own seed. And since there is no really portable and easily accessible source 
of a random number, there is a default seed. To set your own seed, the command 
is

"t_random seed <seed cpu1> <seed cpu2>...."

The following procedure uses the process id to generate a rather random seed. 

set cmd "t_random seed"
for {set i 0} {$i < [setmd n_nodes]} { incr i } {
        lappend cmd [expr [pid] + $i]
}
eval $cmd

Cheers,
Axel

-- 
Dr. Axel Arnold Tel: +49 711 685 63593
ICP, Universität Stuttgart      Email: address@hidden
Pfaffenwaldring 27
70569 Stuttgart, Germany




reply via email to

[Prev in Thread] Current Thread [Next in Thread]