With ocaml, when you call the function Random.self_init (),
it is not possible to know what was the seed used.
In some situations, it would be usefull to know what was this seed, in order to call again the script, in case there was an error, and to try to see how to fix it. Indeed sometimes, it is usefull to call the script again with the same seed, to find the fix.
Files:
$ diff -u random.ml.orig random.ml
$ \ocaml -I . random.cmo OCaml version 4.14.1 # Random.self_init () ;; [| 72; 108; 133; 114; 205; 237; 152; 187; 115; 248; 99; 231; |] - : unit = () #
With this seed, we can then call Random.full_init,
and we will have exactly the same sequence:
$ \ocaml -I . random.cmo OCaml version 4.14.1 # Random.self_init () ;; [| 11; 253; 220; 109; 226; 195; 177; 136; 0; 142; 103; 197; |] - : unit = () # Random.int 100 ;; - : int = 17 #
Another session:
$ \ocaml -I . random.cmo OCaml version 4.14.1 # Random.full_init ;; - : int array -> unit = <fun> # Random.full_init [| 11; 253; 220; 109; 226; 195; 177; 136; 0; 142; 103; 197; |] ;; - : unit = () # Random.int 100 ;; - : int = 17 #