Advertisement
skb50bd

RandomList

Mar 7th, 2019
1,988
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.38 KB | None | 0 0
  1. open System.Threading
  2. let randomNumber x =
  3.   Thread.Sleep(1)
  4.   (new System.Random()).Next(1, x)
  5.  
  6. let randomIndividual x =
  7.   [for _ in 1..x -> randomNumber x]
  8.  
  9. let randomPopulation count size =
  10.   [for _ in 1..count -> randomIndividual size]
  11.  
  12. let printPopulation population =
  13.   population |>
  14.   List.iter (fun x -> printf "%A\n" x)
  15.  
  16. printPopulation (randomPopulation 10 8)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement