[Python] random: what is the default seed?

Discussão em 'Python' iniciado por Stack, Agosto 8, 2025.

  1. Stack

    Stack Membro Participativo

    For Python 3, I can find many different places on the internet stating that the default seed for the random module is based on system time.

    Is this also the case for Python 2.7? I imagine it is, because if I start two different Python processes, and in both I do import random; random.random() then the two different processes return different results.

    If it does use system time, what is the actual seed used? (E.g. "number of seconds since midnight" or "number of microseconds since UNIX epoch", or ...) If not, what is used to seed the PRNG?

    Continue reading...

Compartilhe esta Página