tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
17
Task/Probabilistic-choice/PicoLisp/probabilistic-choice.l
Normal file
17
Task/Probabilistic-choice/PicoLisp/probabilistic-choice.l
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(let (Count 1000000 Denom 27720 N Denom)
|
||||
(let Probs
|
||||
(mapcar
|
||||
'((I S)
|
||||
(prog1 (cons N (*/ Count I) 0 S)
|
||||
(dec 'N (/ Denom I)) ) )
|
||||
(range 5 12)
|
||||
'(aleph beth gimel daleth he waw zayin heth) )
|
||||
(do Count
|
||||
(inc (cddr (rank (rand 1 Denom) Probs T))) )
|
||||
(let Fmt (-6 12 12)
|
||||
(tab Fmt NIL "Probability" "Result")
|
||||
(for X Probs
|
||||
(tab Fmt
|
||||
(cdddr X)
|
||||
(format (cadr X) 6)
|
||||
(format (caddr X) 6) ) ) ) ) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue