Some commits in the way of cleaning up the Rust and generating module lists.

This commit is contained in:
2019-10-31 16:37:16 -04:00
parent 3b0bd25dfa
commit c52dadcf22
11 changed files with 203 additions and 116 deletions

View File

@@ -0,0 +1,19 @@
module Generators
where
import Numeric(showHex)
import System.Random(RandomGen,random)
generateNum :: RandomGen g => g -> Word -> (Integer, g)
generateNum g size =
let (x, g') = random g
x' = x `mod` (2 ^ size)
in (x', g')
showX :: Integer -> String
showX x | x < 0 = "-" ++ showX (abs x)
| otherwise = showHex x ""
showB :: Bool -> String
showB False = "0"
showB True = "1"