1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Is a PRNG possible?

  1. Jul 8, 2012 #1
    randomness is a hard thing, getting a computer to generate it in a way that allows data to be reused in a secure fashion is even harder. here's my own vain attempt at the bugger. the code is in python.
    Code (Text):

    v = [0]*3
    v[0] = 0x96696996
    v[1] = seed
    v[2] = 0xa5a5bdbd
    def rot(x,k):
       return ((x<<k)|(x>>(32-k))&4294967295
    def rng():
       v[0],v[1],v[2] = rot(v[2],8), v[0]^(~v[1]&v[2]), rot(v[1],17)
       return v[1]
     
    i've run several randomness tests on it from the diehard sweet, as far as i can tell it is indeed "random" data. currently the cycle length isn't very long however, i suspect the average to be about 2^31, no where near enough for cryptographic purposes. though, it wouldn't be hard to extend it to a much longer cycle length, if that is your desire.
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Is a PRNG possible?
  1. Is it possible (Replies: 4)

  2. Is This possible? (Replies: 21)

  3. Is this possible! (Replies: 4)

Loading...