#range #random #unique

randge

Generate unique random numbers

2 stable releases

1.1.0 Dec 6, 2020
1.0.0 Dec 4, 2020

#2268 in Algorithms

MIT license

22KB
579 lines

randge

Rust version documentation LICENSE

Generate unique random numbers

Example

use rand::thread_rng;

let v = randge(-15..15, 5, thread_rng());
let v: Vec<_> = v.collect();
// output: like [13, -3, -14, 5, 3]

lib.rs:

Generate random numbers that are not repeated in the range

Example

use rand::thread_rng;

let v = randge(-15..15, 5, thread_rng());
let v: Vec<_> = v.collect();
// output: like [13, -3, -14, 5, 3]

Features

  • rand

Dependencies

~1.5–2.2MB
~39K SLoC