123456789101112131415161718192021222324252627282930313233343536moduleLowLevel=structtypet=(int64,Bigarray.int64_elt,Bigarray.c_layout)Bigarray.Array1.tletof_int64_arraya=ifArray.lengtha<>4theninvalid_arg"Xoshiro256plusplus.LowLevel.of_int64_array";Bigarray.(Array1.of_arrayint64c_layout)aletto_int64_arrayba=Array.init4(Bigarray.Array1.getba)externalnext:t->int64="caml_x256pp_next"externaljump:t->unit="caml_x256pp_jump"externallong_jump:t->unit="caml_x256pp_long_jump"endincludeMakeRandom.Full30Init64(structtypestateexternalbits:state->int="caml_x256pp_bits"externalnew_state:unit->state="caml_x256pp_new_state"externalassign:state->state->unit="caml_x256pp_assign"letinit_size=4externalinit:state->int64array->unit="caml_x256pp_init"letdefault_seed=135801055end)(* Note to self [from Niols]: One can see that the basic functions (eg. [val
bits: unit -> int]) in fact hide an OCaml default state which will be passed
to C every time, which means that, in order to run a [unit -> int], we have
to copy and unbox a state. It is then tempting to duplicate the code, to
write C function using a C state, and to bind these functions to OCaml. I
have tried, and it really increases the complexity of the code for...
nothing. like at all. like it is even possibly slower than before. *)