summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib-random/testvectors.ml
blob: b8f09ae0584bd4fff76638ef156c51cfae1d5fb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(* TEST
*)

(* Check the numbers drawn from a known state against the numbers
   obtained from the reference Java implementation. *)

open Bigarray

let _ =
  let a = Array1.of_array Int64 C_layout [| 1L; 2L; 3L; 4L |] in
  (* Violate abstraction of type Random.State.t to manipulate state directly *)
  let r = (Obj.magic a : Random.State.t) in
  for i = 0 to 49 do
    Printf.printf "%Ld\n" (Random.State.bits64 r)
  done

let _ = exit 0