Crate random_wheel [−] [src]
A Little implementation of the random-wheel principle, RandomWheel<T>.
https://en.wikipedia.org/wiki/Fitness_proportionate_selection
Examples
You can explicitly create a RandomWheel<T> with new():
use random_wheel::RandomWheel; let rw: RandomWheel<i32> = RandomWheel::new();
You can push values onto the random-wheel (which will grow the wheel as needed):
Popping values works in much the same way:
use random_wheel::RandomWheel; let mut rw = RandomWheel::new(); rw.push(5., 1); rw.push(1., 2); // you have 5 chances out of 6 to hit 1 let one_or_two = rw.pop();
Structs
| RandomWheel |
a little implementation of a random-wheel. |