[Scilab-users] rand("seed",s)

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

[Scilab-users] rand("seed",s)

Hallo Scilab équipe,

In my application it is vital   -  in addition to the normal focus when using seeds -  that different seeds in rand("seed",seed) produce different random number series. (1) Is that the case?

I am aware that  seed has to be a non negative integer. (2) Are there any further restrictions?  (3) What is the upper bound?

The minimal example below is as expected.

Kind regards

Jens

s1=1e3; 
s2=1e10;
rand("seed",s1);
r1=rand(3,1);
rand("seed",s2);
r2=rand(3,1);
//
rand("seed",s1)
r3=rand(3,1);
rand("seed",s2);
r4=rand(3,1);
r1234=[r1 r2 r3 r4]
----------------------------------------------------





_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: rand("seed",s)

Le 29/04/2019 à 19:03, Jens Simon Strom a écrit :

Hallo Scilab équipe,

In my application it is vital   -  in addition to the normal focus when using seeds -  that different seeds in rand("seed",seed) produce different random number series. (1) Is that the case?

Yes. However with "rand" you have a periodicit of 2^31 (this is explained in the help page).

Please use "grand" instead of "rand", as grand produces sequences with better properties, moreover you have the choice of the basic generator. The default one "Mersenne-Twister" has period 2^199937. See the help page of grand for more details.

S.

I am aware that  seed has to be a non negative integer. (2) Are there any further restrictions?  (3) What is the upper bound?

The minimal example below is as expected.

Kind regards

Jens

s1=1e3; 
s2=1e10;
rand("seed",s1);
r1=rand(3,1);
rand("seed",s2);
r2=rand(3,1);
//
rand("seed",s1)
r3=rand(3,1);
rand("seed",s2);
r4=rand(3,1);
r1234=[r1 r2 r3 r4]
----------------------------------------------------





_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users


-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users