aboutsummaryrefslogtreecommitdiff
path: root/crates/sloth_vm/src/sloth_std/rand.rs
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-04-27 18:42:28 -0500
committerGitHub <noreply@github.com>2023-04-27 18:42:28 -0500
commit86eab2dc7dc2f88e0f56d09ae3b5f36cf8d9706e (patch)
treed312fd5c0981df90aef29a4131703ae89f328268 /crates/sloth_vm/src/sloth_std/rand.rs
parent448babe8090c2bcf177c23efd2257a926a1d07f7 (diff)
parentd6b12291db70ea19d37d84226161f964400ae0b2 (diff)
downloadsloth-86eab2dc7dc2f88e0f56d09ae3b5f36cf8d9706e.tar.gz
Merge pull request #5 from slothlang/standard-library
Standard Library
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`",
+ ),
};