Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8532373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:42:03+00:00 2026-06-11T09:42:03+00:00

Is there guarantee that pyhon2/python3 script with random generator initialized with random.setstate() or random.seed()

  • 0

Is there guarantee that pyhon2/python3 script with random generator initialized with random.setstate() or random.seed() will produce same sequence of pseudo-randomness across different versions and platforms ? (for example python 3.1 on Mac , the same as python 3.2 on Linux 64-bit)

Question is about both: python2 and python3, with assumption that python3 scripts will run on python3 interpreters and vice versa.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:42:04+00:00Added an answer on June 11, 2026 at 9:42 am

    Python 2.3 and up use the Mersenne Twister generator, which is independent of the system random function (implemented as a C extension module for Python). For any version using the Mersenne Twister, the results should be the same across versions and platforms.

    Previously, you could guarantee backwards compatibility using the WichmannHill generator, but unfortunately it seems that has been removed in Python 3.x.

    If you absolutely need to guarantee compatibility, write your own Random subclass (or use a stable external implementation, e.g. simplerandom) as recommended by the random documentation:

    Class Random can also be subclassed if you want to use a different basic generator of your own devising: in that case, override the random(), seed(), getstate(), setstate() and jumpahead() methods. Optionally, a new generator can supply a getrandbits() method — this allows randrange() to produce selections over an arbitrarily large range.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using UNIX socket APIs on Linux, is there any way to guarantee that I
Is there a guarantee that (the default, system) Java class loader doesn't attempt to
Is there a Google Image Search API that will return data in XML format?
Is there any guarantee that the array of filenames returned from a glob (e.g.
In C++ when i do new (or even malloc) is there any guarantee that
I have some data being loaded from a server, but there's no guarantee that
Is there any guarantee, that the ifs of a if-else if-else if-else block, are
This seems like a strange thing to say. There is no guarantee that the
Is there a guarantee that each library header looks something like that? #ifndef STDIO_H
For example, if I have an echo statement, there's no guarantee that the browser

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.