Added note about Chrome's way to get doubles. Added readme content.

This commit is contained in:
Douglas Goddard 2016-05-17 09:10:09 -04:00
parent fdaf830594
commit a12e7e3c10
2 changed files with 20 additions and 3 deletions

17
README
View File

@ -0,0 +1,17 @@
For usage on the LA Time's powerball simulator. Careful about clicking the page.
Run the following snippet in your browser's console.
_ = []; for(var i=0; i<5; ++i) { _.push(Math.random()) } ; console.log(_)
Paste at least 3 of those values into the dubs array in main().
Set the browser in main() to Chrome or Firefox. (Safari hasn't updated yet.)
python xs128p.py
The winning numbers should have an arrow. Click once on the number inputs and tab between them to enter your "pick".
Click once on the play button.
Enjoy your lotto winnings :)

View File

@ -2,7 +2,7 @@ import sys
import math
import struct
import random
sys.path.append('/path/to/z3/build/')
sys.path.append('/home/dgoddard/tools/z3/build/')
from z3 import *
# xor_shift_128_plus algorithm
@ -90,7 +90,7 @@ def power_ball(generated, browser):
# Firefox nextDouble():
# (rand_uint64 & ((1 << 53) - 1)) / (1 << 53)
# Chrome nextDouble():
# (rand_uint64 & ((1 << 52) - 1)) | 0x3FF0000000000000
# ((rand_uint64 & ((1 << 52) - 1)) | 0x3FF0000000000000) - 1.0
# Safari weakRandom.get():
# (rand_uint64 & ((1 << 53) - 1) * (1.0 / (1 << 53)))
@ -102,7 +102,7 @@ def main():
browser = 'chrome'
# browser = 'firefox'
print 'BROWSER: %s' % browser
# In your browser's JavaScript console:
# _ = []; for(var i=0; i<5; ++i) { _.push(Math.random()) } ; console.log(_)
# Enter at least 3 random numbers you observed here: