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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -