Derive scalar changes and composition laws
This commit is contained in:
10 files changed
+527
-3
No files matched your search
@@ -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)
|
||||
Reference in new issue
Block a user