larger seeds for Mersenne

Discussion in 'Python' started by jt, Feb 5, 2004.

  1. jt

    jt Guest

    I'm trying to learn how to use a seed for the random module that is
    larger than the integer produced by python's built-in hash(x) function.
    >From the documentation, it says:


    "If x is not None or an int or long, hash(x) is used instead. If x is an
    int or long, x is used directly."

    So if I through something other than an int or long, it gets hashed down
    to an int. Which is what, 10 bytes or so? So it seems like it would be
    preferable to use something like md5 or sha to hash because then I'd get
    16 or 20 bytes for the seed. But the problem is that md5 and sha don't
    hash to a long. They include lots of other printable and nonprintable
    characters.

    Does anyone know of a hashing algorithm that hashes to a long that's
    16-20+ bytes long? Thanks for any help.

    jt
     
    jt, Feb 5, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Williams
    Replies:
    1
    Views:
    1,394
    Dylan Parry
    Jun 3, 2005
  2. jt

    larger seeds for Mersenne

    jt, Feb 6, 2004, in forum: Python
    Replies:
    0
    Views:
    327
  3. Intiha

    Generating random seeds for simulation

    Intiha, Aug 25, 2006, in forum: C Programming
    Replies:
    6
    Views:
    448
    Dave Thompson
    Sep 4, 2006
  4. Patricia Shanahan

    How to unit test random seeds?

    Patricia Shanahan, Dec 20, 2007, in forum: Java
    Replies:
    12
    Views:
    844
    Patricia Shanahan
    Dec 23, 2007
  5. Replies:
    4
    Views:
    277
Loading...

Share This Page