help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast random numbers


From: Doug Stewart
Subject: Re: Fast random numbers
Date: Mon, 25 Jul 2016 04:53:25 -0400



On Mon, Jul 25, 2016 at 4:08 AM, Max Görner <address@hidden> wrote:
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

This last time looks wrong.



here is what I get


>>      n = 4.6E7;
>>    k = 0.72*n;
>>    tic(); randperm(n, k); toc()
Elapsed time is 0.947548 seconds.
>>  tic(); 1337 + zeros(1, k); toc()
Elapsed time is 0.356367 seconds.
>>      n = 10000;
>>    tic(); rand(n); toc()
Elapsed time is 1.1658 seconds.
>>  tic(); 1337 + zeros(n); toc()
Elapsed time is 1.56768 seconds.



 

Sincerely


Max Görner

--
PGP: https://wwwpub.zih.tu-dresden.de/~maxgoern/2FE6023F.asc

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave



--
DASCertificate for 206392


reply via email to

[Prev in Thread] Current Thread [Next in Thread]