File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def logComputable {α : Type} [Lean.ToMessageData α] (prog : RandPCG IO α) : C
2020
2121attribute [computable] sumTwo
2222
23- run_cmd do logComputable sumTwoComputable
23+ run_cmd logComputable sumTwoComputable
2424
2525@[computable]
2626noncomputable
@@ -31,20 +31,20 @@ def unfoldSumTwo : MeasureTheory.Measure ℝ := rdo
3131
3232attribute [computable] centred
3333
34- run_cmd do logComputable (centredComputable 20 )
34+ run_cmd logComputable (centredComputable 20 )
3535
3636attribute [computable] branchOn
3737
3838run_cmd do logComputable (branchOnComputable 20 )
3939
40- run_cmd do logComputable (branchOnComputable (-1 ))
40+ run_cmd logComputable (branchOnComputable (-1 ))
4141
4242attribute [computable] fairCoin
4343
44- run_cmd do logComputable (fairCoinComputable)
44+ run_cmd logComputable (fairCoinComputable)
4545
4646attribute [computable] Bind.twoCoins
4747
48- run_cmd do logComputable (Bind.twoCoinsComputable)
48+ run_cmd logComputable (Bind.twoCoinsComputable)
4949
5050end Test.Computable
Original file line number Diff line number Diff line change 1+ module
2+
3+ public import RandomDo
4+
5+ set_option linter.style.header false
6+
7+ open NumLean IO Lean
8+
9+ run_cmd do
10+ let x ← rand 0 1000
11+ logInfo m! "Random number between 0 and 1000: { x} "
12+
13+ run_cmd do
14+ let x ← (runRandPCG <| randInt 1000 : IO Int)
15+ logInfo m! "Random number between 0 and 1000 (PCG): { x} "
16+
17+ run_cmd do
18+ let x ← (runRandPCG <| normal 10 2 : IO Float)
19+ logInfo m! "{ x} "
20+
21+ run_cmd do
22+ let x ← (runRandPCG <| exponential 10 : IO Float)
23+ logInfo m! "{ x} "
24+
25+ run_cmd do
26+ let x ← (runRandPCG <| binomial 10 0 .5 : IO Nat)
27+ logInfo m! "{ x} "
28+
29+ run_cmd do
30+ let x ← (runRandPCG <| bernoulli 0 .5 : IO Nat)
31+ logInfo m! "{ x} "
You can’t perform that action at this time.
0 commit comments