[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fast random numbers
From: |
Max Görner |
Subject: |
Re: Fast random numbers |
Date: |
Mon, 25 Jul 2016 10:08:12 +0200 |
User-agent: |
Mutt/1.6.0 (2016-04-01) |
Thank you for your fast reply. Below you can find a script showing two
scenarios. The script also shows that the runtime is not due to memory
assignment or writing.
#!/usr/bin/octave --no-init-file
n = 4.6E7;
k = 0.72*n;
tic(); randperm(n, k); toc() #1.7 seconds
tic(); 1337 + zeros(1, k); toc() #0.2 seconds
n = 10000;
tic(); rand(n); toc() #1.7
tic(); 1337 + zeros(n); toc() #0.7
Sincerely
Max Görner
--
PGP: https://wwwpub.zih.tu-dresden.de/~maxgoern/2FE6023F.asc