Skip to content

Commit

Permalink
Remove comment; update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
aspen committed Sep 19, 2020
1 parent 0c9917d commit bd5b5bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ Current version: **0.4.0**
A library meant for fast, random number generation with quick compile time, and minimal dependencies.

## Examples
### Generating a u64
### Generating a number
```rs
use nanorand::{RNG, WyRand};

fn main() {
let mut rng = WyRand::new();
println!("Random 64-bit number: {}", rng.generate::<u64>());
println!("Random number: {}", rng.generate::<u64>());
}
```
### Generating a number in a range
```rs
use nanorand::{RNG, WyRand};

fn main() {
let mut rng = WyRand::new();
println!("Random number between 1 and 100: {}", rng.generate_range::<u64>(1, 100));
}
```
### Shuffling a Vec
Expand Down
12 changes: 0 additions & 12 deletions src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,6 @@ macro_rules! randomgen_number {
}
}

/*
uint32_t bounded_rand(rng_t& rng, uint32_t range) {
uint32_t t = (-range) % range;
do {
uint32_t x = rng();
uint64_t m = uint64_t(x) * uint64_t(range);
uint32_t l = uint32_t(m);
} while (l < t);
return m >> 32;
}
*/
impl<R: RNG> RandomRange<R> for $unsigned {
fn random_range(r: &mut R, lower: $unsigned, upper: $unsigned) -> Self {
let t = ((-(upper as $signed)) % (upper as $signed)) as $unsigned;
Expand Down

0 comments on commit bd5b5bc

Please sign in to comment.