mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
readme: try to make the random array deterministic
This commit is contained in:
parent
4294e90929
commit
bf43d9648e
1 changed files with 9 additions and 7 deletions
16
README.md
16
README.md
|
|
@ -211,11 +211,13 @@ val arr : int array = [|4; 2; 1; 5; 1; 10; 3|]
|
||||||
- : int array = [|1; 1; 2; 3; 4; 5; 10|]
|
- : int array = [|1; 1; 2; 3; 4; 5; 10|]
|
||||||
|
|
||||||
|
|
||||||
# let arr = Array.init 40 (fun _-> Random.int 300);;
|
# let arr =
|
||||||
|
let rand = Random.State.make [| 42 |] in
|
||||||
|
Array.init 40 (fun _-> Random.State.int rand 300);;
|
||||||
val arr : int array =
|
val arr : int array =
|
||||||
[|236; 177; 255; 17; 37; 46; 230; 287; 120; 132; 216; 211; 267; 47; 28;
|
[|64; 220; 247; 196; 51; 186; 22; 106; 58; 58; 11; 161; 243; 111; 74; 109;
|
||||||
127; 102; 103; 294; 298; 4; 290; 247; 188; 157; 54; 17; 251; 277; 107;
|
49; 135; 59; 192; 132; 38; 19; 44; 126; 147; 182; 83; 95; 231; 204; 121;
|
||||||
21; 261; 236; 243; 152; 21; 297; 55; 43; 279|]
|
142; 255; 72; 85; 95; 93; 73; 202|]
|
||||||
# Moonpool.Fut.spawn ~on:pool
|
# Moonpool.Fut.spawn ~on:pool
|
||||||
(fun () -> quicksort arr 0 (Array.length arr))
|
(fun () -> quicksort arr 0 (Array.length arr))
|
||||||
|> Moonpool.Fut.wait_block_exn
|
|> Moonpool.Fut.wait_block_exn
|
||||||
|
|
@ -223,9 +225,9 @@ val arr : int array =
|
||||||
- : unit = ()
|
- : unit = ()
|
||||||
# arr;;
|
# arr;;
|
||||||
- : int array =
|
- : int array =
|
||||||
[|4; 17; 17; 21; 21; 28; 37; 43; 46; 47; 54; 55; 102; 103; 107; 120; 127;
|
[|11; 19; 22; 38; 44; 49; 51; 58; 58; 59; 64; 72; 73; 74; 83; 85; 93; 95; 95;
|
||||||
132; 152; 157; 177; 188; 211; 216; 230; 236; 236; 243; 247; 251; 255; 261;
|
106; 109; 111; 121; 126; 132; 135; 142; 147; 161; 182; 186; 192; 196; 202;
|
||||||
267; 277; 279; 287; 290; 294; 297; 298|]
|
204; 220; 231; 243; 247; 255|]
|
||||||
```
|
```
|
||||||
|
|
||||||
### More intuition
|
### More intuition
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue