Skip to content

Instantly share code, notes, and snippets.

@likuilin
Created September 8, 2023 05:59
Show Gist options
  • Save likuilin/01605f5715f448e1cd5ac56eb8fe1d72 to your computer and use it in GitHub Desktop.
Save likuilin/01605f5715f448e1cd5ac56eb8fe1d72 to your computer and use it in GitHub Desktop.
Map a single random [0, 292201338) integer onto powerball numbers
import itertools
n = # pick a random integer in range(292201338), idk hash something important and mod that or something
pb = (n % 26) + 1
n = n // 26
print(next(itertools.islice(itertools.combinations(range(1, 70), 5), n, n+1)), pb)
# n=0 yields (1, 2, 3, 4, 5) 1
# n=1 yields (1, 2, 3, 4, 5) 2
# n=26 yields (1, 2, 3, 4, 6) 1
# n=292201337 yields (65, 66, 67, 68, 69) 26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment