fix random
bugs
This commit is contained in:
parent
de647097b7
commit
1fff319bb6
|
@ -910,8 +910,8 @@ fn dist {
|
||||||
fn random {
|
fn random {
|
||||||
"Returns a random number. With zero arguments, returns a random number between 0 (inclusive) and 1 (exclusive). With one argument, returns a random number between 0 and n. With two arguments, returns a random number between m and n. Alternately, given a list, it returns a random member of that list."
|
"Returns a random number. With zero arguments, returns a random number between 0 (inclusive) and 1 (exclusive). With one argument, returns a random number between 0 and n. With two arguments, returns a random number between m and n. Alternately, given a list, it returns a random member of that list."
|
||||||
() -> base :random ()
|
() -> base :random ()
|
||||||
(n as :number) -> base :random (n)
|
(n as :number) -> mult (n, random ())
|
||||||
(m as :number, n as :number) -> add (m, random (n))
|
(m as :number, n as :number) -> add (m, random (sub (n, m)))
|
||||||
(l as :list) -> {
|
(l as :list) -> {
|
||||||
let i = do l > count > random > floor
|
let i = do l > count > random > floor
|
||||||
at (l, i)
|
at (l, i)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user