matlab - Normrnd Function generating same random numbers -
is possible normrnd function of matlab generates same set of random numbers on 2 different machines (when no seed has been set)?
it may if both generators seeded same way on both machine (ex. launched @ same time, , seeded current time). actually, mentionned in comment, seeding in matlab not current time, same @ launch if not seeded.
- if wish reproduce same series of random numbers, may take @ example: can save current seed , reuse later.
save current generator settings in s:
> s = rng; call rand generate vector of random values: > x = rand(1,5) > x = 0.8147 0.9058 0.1270 0.9134 0.6324
restore original generator settings calling rng. generate new set of random values , verify x , y equal:
> rng(s); y = rand(1,5) > y = 0.8147 0.9058 0.1270 0.9134 0.6324
matlab gives possibility choose generator. choosing pseudo random number generator mersenne twister, , seeding same seed @ each run, same series.
if wish have different series of randm numbers @ each run, can use
rng('shuffle')
, seeding generator clock time @ start.
Comments
Post a Comment