let bool prng =
(* let pred_len = pred 30 in *)
let pred_len = pred (Sys.word_size -2) in
let index = ref pred_len in
let bits = Array.make (succ pred_len) false in
fun () ->
if !index = pred_len then index := 0 else incr index;
if !index = 0 then (
let b = Random.State.bits prng in
for i=0 to pred_len do bits.(i) <- (*Femtolib.*)Pervasives.extract_bit b i done);
bits.(!index)