How to make Python run as fast (or faster) than Julia
bartc
bc at freeuk.com
Tue Feb 27 06:27:21 EST 2018
On 27/02/2018 02:27, Chris Angelico wrote:
> On Tue, Feb 27, 2018 at 12:57 PM, bartc <bc at freeuk.com> wrote:
>> On 27/02/2018 00:35, Chris Angelico wrote:
>> Anyway, even this pure Python version can deliver pseudo random numbers at
>> some 200,000 per second, while the built-in generator does 450,000 per
>> second, so it's not bad going.
>
> The built-in generator is using a completely different algorithm
> though, so rate of generation isn't the entire story. How long is the
> period of the one you're using? (How long before it loops?)
I believe it's 5*2**1320480*(2**64-1) according to the author's comment.
I haven't tested that.
(By looping I understand that to mean, before the same sequence starts
again. Because as the numbers are 64 bits, individual numbers will
inevitably be repeated from time to time.)
--
Bartc
More information about the Python-list
mailing list