|
From: | Julien Bect |
Subject: | Re: Fast random numbers |
Date: | Mon, 25 Jul 2016 11:09:38 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 |
Le 25/07/2016 à 10:53, Doug Stewart a
écrit :
This is surprising. I get runtimes more similar to those sent by Max on Octave 4.0.3 (Linux 64 bits) : >> n = 10000; >> tic(); rand(n); toc() Elapsed time is 1.13176 seconds. >> tic(); 1337 + zeros(n); toc() Elapsed time is 0.504124 seconds. But, returning to Max's original question: this is already *very* fast. It means that generating random numbers is almost as fast copying a constant in memory (only slower by a factor of approximately 2). Under the hood, Octave uses the standard state-of-the-art Mersenne Twister RNG. You won't be able to go much faster than this, unless you can use parallel computing (but then you'll need to switch to another RNG, which allows parallel streams of pseudo-random numbers...). @++ Julien |
[Prev in Thread] | Current Thread | [Next in Thread] |