Derive scalar changes and composition laws

This commit is contained in:
milner committed 2017-03-11 21:32:00 +00:00
1 parent 780136e802
commit 0c88eaa7c4
10 files changed
+527 -3

No files matched your search

+14
View File
@@ -92,3 +92,17 @@ let check_message name expected thunk =
match error_of thunk with
| None -> fail name "expected a diagnostic"
| Some diagnostic -> check_equal_string name expected diagnostic.Diagnostic.message
type rng = { mutable state : int }
let rng seed = { state = seed land 0x3FFFFFFF }
let next rng =
rng.state <- (rng.state * 1103515245 + 12345) land 0x3FFFFFFF;
rng.state
let range rng bound = if bound <= 0 then 0 else next rng mod bound
let pick rng items = List.nth items (range rng (List.length items))
let string_of_int_list items = Util.join "," (List.map string_of_int items)