A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-June/065881.html below:

[Python-Dev] a note in random.shuffle.__doc__ ...

[Python-Dev] a note in random.shuffle.__doc__ ... [Python-Dev] a note in random.shuffle.__doc__ ...Tim Peters tim.peters at gmail.com
Mon Jun 12 05:25:53 CEST 2006
[Terry Jones]
> The code below uses a RNG with period 5, is deterministic, and has one
> initial state. It produces 20 different outcomes.

Well, I'd call the sequence of 20 numbers it produces one outcome.
>From that view, there are at most 5 outcomes it can produce (at most 5
distinct 20-number sequences).  In much the same way, there are at
most P distinct infinite sequences this can produce, if the PRNG used
by random.random() has period P:

def belch():
    import random, math
    start = random.random()
    i = 0
    while True:
        i += 1
        yield math.fmod(i * start, 1.0)

The trick is to define "outcome" in such a way that the original claim
is true :-)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4