diff options
author | siddharth <s@ricketyspace.net> | 2021-08-17 20:21:59 -0400 |
---|---|---|
committer | siddharth <s@ricketyspace.net> | 2021-08-17 20:21:59 -0400 |
commit | c4d28bbe42ca88109ab462742f2b72ad30af209a (patch) | |
tree | 4f34e5609905242e06bfc0464eefbc40db71e332 | |
parent | ae8a6146df3bddb02e3814327a41f5c810d57a4f (diff) |
challenge: update C22
Use MTRand.Extract and MTRand.Seed instead of MTExtact and MTSeed.
-rw-r--r-- | challenge/c22.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/challenge/c22.go b/challenge/c22.go index 603cb9e..c947f94 100644 --- a/challenge/c22.go +++ b/challenge/c22.go @@ -11,6 +11,7 @@ import ( ) func C22() { + mt := new(lib.MTRand) minWait := 40 * time.Second maxWait := 1000 * time.Second randomWait := func() { @@ -25,17 +26,17 @@ func C22() { randomWait() fmt.Printf("Generating seed from current time...\n") - lib.MTSeed(uint32(time.Now().Unix())) + mt.Seed(uint32(time.Now().Unix())) randomWait() fmt.Printf("Extracting first random 32-bit garbage fron RNG...\n") - random := lib.MTExtract() + random := mt.Extract() fmt.Printf("Cracking seed...\n") guess := uint32(time.Now().Unix()) for { - lib.MTSeed(guess) - x := lib.MTExtract() + mt.Seed(guess) + x := mt.Extract() if x == random { fmt.Printf("Found seed %v\n", guess) break |