Module rune_modules::rand
source · Expand description
The native rand
module for the Rune Language.
§Usage
Add the following to your Cargo.toml
:
rune-modules = { version = "0.13.2", features = ["rand"] }
Install it into your context:
let mut context = rune::Context::with_default_modules()?;
context.install(rune_modules::rand::module(true)?)?;
Use it in Rune:
ⓘ
fn main() {
let rng = rand::WyRand::new();
let rand_int = rng.int();
println(`Random int: {rand_int}`);
let rand_int_range = rng.int_range(-100, 100);
println(`Random int between -100 and 100: {rand_int_range}`);
}
Functions§
- Construct the
rand
module.