Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
20
Task/Probabilistic-choice/F-Sharp/probabilistic-choice.fs
Normal file
20
Task/Probabilistic-choice/F-Sharp/probabilistic-choice.fs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Probabilistic choice. Nigel Galloway: November 15th., 2024
|
||||
type items=Aleph|Beth|Gimel|Daleth|He|Waw|Zayin|Heth
|
||||
let item=function n when n<5544 ->Aleph
|
||||
|n when n<10164->Beth
|
||||
|n when n<14124->Gimel
|
||||
|n when n<17589->Daleth
|
||||
|n when n<20669->He
|
||||
|n when n<23441->Waw
|
||||
|n when n<25961->Zayin
|
||||
|_->Heth
|
||||
let R=System.Random()
|
||||
let expected=function Aleph ->1000000/5
|
||||
|Beth ->1000000/6
|
||||
|Gimel ->1000000/7
|
||||
|Daleth->1000000/8
|
||||
|He ->1000000/9
|
||||
|Waw ->1000000/10
|
||||
|Zayin ->1000000/11
|
||||
|Heth ->(1000000*1759)/27720
|
||||
Seq.init 1000000 (fun _->R.Next(0,27720))|>Seq.countBy item|>Seq.iter(fun(n,g)->printfn $"item={n} count={g} expected={expected n}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue