File: testvectors.ml

package info (click to toggle)
js-of-ocaml 5.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 32,020 kB
  • sloc: ml: 91,250; javascript: 57,289; ansic: 315; makefile: 271; lisp: 23; sh: 6; perl: 4
file content (17 lines) | stat: -rw-r--r-- 441 bytes parent folder | download
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