Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- import threading
- import time
- RNG = 0
- hRandomAdd = 0
- hRandomSub = 0
- whichRandom = False
- numberToFind = randint(0,255)
- if randint(0,1) != 0:
- whichRandom = True
- print "Looking for Random Number %s in %s" % (numberToFind, "hRandomAdd" if whichRandom else "hRandomSub")
- time.sleep(3)
- def callRandom():
- global hRandomAdd
- global hRandomSub
- hRandomAdd += RNG
- hRandomSub -= (RNG + ((hRandomAdd & 0b100000000) >> 8))
- hRandomAdd = hRandomAdd & 0xff
- hRandomSub = hRandomSub % 0x100
- print "hRandomAdd: %s\r\nhRandomSub: %s\r\nrDIV: %s\r\n---------------" % (hRandomAdd,hRandomSub,RNG)
- r = threading.Timer(1/59.7275,callRandom)
- r.daemon = True
- r.start()
- def rDIV():
- t = threading.Timer(1/16384, rDIV)
- t.daemon = True
- t.start()
- global RNG
- RNG += 1
- RNG = RNG & 0xff
- callRandom()
- rDIV()
- if whichRandom:
- while hRandomAdd != numberToFind:
- pass
- else:
- while hRandomSub != numberToFind:
- pass
- print "\r\nDone!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement