structure random :> RANDOM = struct fun random p q = let val w = MLton.Random.rand () val x = (Real.fromInt o Word.toIntX) w val n = Real.abs (x / Real.fromInt (Option.valOf Int.maxInt)) in (n * (q - p)) + p end fun random_seed () = MLton.Random.srand (Option.valOf (MLton.Random.seed ())) end