let bernouilli prng length density = assert (0. <= density && density <= 1.); Array.init length (fun _ -> Random.State.float prng 1. < density)