Code Snippet:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| let pbyte b =
System.Convert.ToString(0uy+b, 2).PadLeft(8,'0')
|> Seq.map(fun x -> x |> function | '0' -> "□" | _ -> "■")
|> Seq.reduce(+)
let rand = System.Random()
sizeof<bool>;;
sizeof<byte>;;
// Array of random booleans
Array.init (1<<<6) (
fun _ -> System.Convert.ToBoolean(rand.Next(0,2))
|> fun x -> System.Convert.ToByte(x) |> pbyte);;
// Array of random bytes
Array.init (1<<<6) (fun _ -> byte(rand.Next(0,256)))
|> Array.map(fun x -> x |> pbyte);;
|
Code output: