From a12e7e3c10fccfc1c4c835c6e4820a0358cc8d93 Mon Sep 17 00:00:00 2001 From: Douglas Goddard Date: Tue, 17 May 2016 09:10:09 -0400 Subject: [PATCH] Added note about Chrome's way to get doubles. Added readme content. --- README | 17 +++++++++++++++++ xs128p.py | 6 +++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README b/README index e69de29..7dbe364 100644 --- a/README +++ b/README @@ -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 :) diff --git a/xs128p.py b/xs128p.py index 6f0b547..a4b762a 100644 --- a/xs128p.py +++ b/xs128p.py @@ -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: