[scilab-Users] bug in rand generation?

leszek.luchowski at iitis.gliwice.pl leszek.luchowski at iitis.gliwice.pl
Mon May 10 12:47:23 CEST 2010


Hi;

I think you need to read about the seed of the random generator.

>From the help in SciLab 4.1.2 (0):

---------------------------- Quote:
rand('seed',n) puts the seed to  n . (by default  n=0  at first call).
End quote ----------------------------

To initialize the generator with a different seed value
at every execution, you may want to use a seed that
depends on the time of execution. I mean time as in
"what time is it", not duration of your program.

Hope this helps,
Leszek.


> I observed the same. cco
>
> On Wed, May 5, 2010 at 8:04 PM, Amaël Delaunoy
> <amael.delaunoy at gmail.com>wrote:
>
>> Dear all,
>>
>> It appears that the rand (also grand) functions generate equal numbers
>> each
>> time Scilab is launched. (tested in several scilab versions, 4.x and 5.2
>> under linux)
>> This is not written in the documentation of those functions.
>> How to reproduce? simply launch scilab, type rand(2,2,'uniform'), exit
>> scilab, launch scilab, type rand(2,2,'uniform') again, values are
>> identical.
>> (same with grand(2,2,'def') for example)
>>
>> Is it an important missing point in the documentation? or a bug of the
>> rand/grand functions?
>> Or am I missing somethinghere?,
>>
>> Regards,
>> Amael
>>
>
>
>
> --
> Eng'r Celso B. Co, PhD ECE
> Assistant Professor
> Dept. of Electronics, Computer, and Communication Engineering,
> Loyola Schools of Science and Engineering, Ateneo De Manila
>




More information about the users mailing list