Crates.io | micro_rand |
lib.rs | micro_rand |
version | 0.0.1 |
source | src |
created_at | 2021-08-23 04:41:57.60231 |
updated_at | 2021-08-23 04:41:57.60231 |
description | 🎲 A tiny, no STD crate for generating (pseudo) random numbers. |
homepage | |
repository | https://github.com/Basicprogrammer10/micro_rand |
max_upload_size | |
id | 440947 |
size | 42,664 |
A tiny, no STD library for generating (pseudo) random numbers.
Just add the following to your Cargo.toml
:
[dependencies]
micro_rand = "0.0.1"
Uses the Linear congruential generator algorithm to generate pseudo random numbers. You must supply a seed value in the form of a i64
integer.
Super Simple Example
// Import Lib
use micro_rand::*;
// Create a new random generator with seed 1234
let mut rnd = Random::new(1234);
// Generate a Number!
let num1 = rnd.next_f64();
// Generate an int between two values
let num2 = rnd.next_int_i64(0, 100);