aboutsummaryrefslogtreecommitdiff
path: root/crates/sloth_vm/src/sloth_std/rand.rs
diff options
context:
space:
mode:
authornic-gaffney <gaffney_nic@protonmail.com>2023-04-18 10:42:45 -0500
committernic-gaffney <gaffney_nic@protonmail.com>2023-04-18 10:42:45 -0500
commitaf02ccd056754c60131d13d74b9fac0e23b2af31 (patch)
tree16b041a84a65f2b285192f79e774b15327885bf9 /crates/sloth_vm/src/sloth_std/rand.rs
parent38b564380a6362a82a0e5269b1e7e3d3635900e7 (diff)
downloadsloth-af02ccd056754c60131d13d74b9fac0e23b2af31.tar.gz
Added more documentation in the native functions
Diffstat (limited to 'crates/sloth_vm/src/sloth_std/rand.rs')
-rw-r--r--crates/sloth_vm/src/sloth_std/rand.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/crates/sloth_vm/src/sloth_std/rand.rs b/crates/sloth_vm/src/sloth_std/rand.rs
index 93da0d7..1718c6d 100644
--- a/crates/sloth_vm/src/sloth_std/rand.rs
+++ b/crates/sloth_vm/src/sloth_std/rand.rs
@@ -16,7 +16,10 @@ pub const GEN_FUNCTION: NativeFunction = NativeFunction {
function: gen,
arity: 0,
returns_value: true,
- doc: None,
+ 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 {
@@ -37,5 +40,9 @@ pub const GEN_RANGE_FUNCTION: NativeFunction = NativeFunction {
function: gen_range,
arity: 2,
returns_value: true,
- doc: None,
+ 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 = gen_range(20, 76); # num \
+ could be any number from 20 to 76`",
+ ),
};