aboutsummaryrefslogtreecommitdiff
path: root/crates/sloth_vm/src/sloth_std/rand.rs
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-05-24 00:23:13 -0500
committerCody <cody@codyq.dev>2023-05-24 00:23:13 -0500
commit9c41dd96cd3652ce9c46307184e8055704655338 (patch)
tree07071d74da7398593fc5b9cfe5c4df0229ee4eb0 /crates/sloth_vm/src/sloth_std/rand.rs
parent2418d68631f6e338251f2d988de2d3fde206982b (diff)
parentdf00e9ff2c2b563c79beb71ba8c510233b04f3bf (diff)
downloadsloth-9c41dd96cd3652ce9c46307184e8055704655338.tar.gz
Merge branch 'master' into compiler
Diffstat (limited to 'crates/sloth_vm/src/sloth_std/rand.rs')
-rw-r--r--crates/sloth_vm/src/sloth_std/rand.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/sloth_vm/src/sloth_std/rand.rs b/crates/sloth_vm/src/sloth_std/rand.rs
index bae0606..870cca1 100644
--- a/crates/sloth_vm/src/sloth_std/rand.rs
+++ b/crates/sloth_vm/src/sloth_std/rand.rs
@@ -16,6 +16,10 @@ pub const GEN_FUNCTION: NativeFunction = NativeFunction {
function: gen,
arity: 0,
returns_value: true,
+ doc: Some(
+ "NativeFunction rand$gen:\n\tdesc: Returns a random number in the range `0.0 .. \
+ 1.0`\n\tExample: `var num = rand$gen(); # num could be any number from 0.0 to 1.0`",
+ ),
};
fn gen_range(_vm: &mut VM, args: &[Primitive]) -> NativeFunctionResult {
@@ -36,4 +40,9 @@ pub const GEN_RANGE_FUNCTION: NativeFunction = NativeFunction {
function: gen_range,
arity: 2,
returns_value: true,
+ doc: Some(
+ "NativeFunction rand$gen_range: \n\targs: min (int), max (int)\n\tdesc: Returns a random \
+ numnber in the range <min> .. <max>\n\tExample: `var num = rand$gen_range(20, 76); # num \
+ could be any number from 20 to 76`",
+ ),
};