Skip to content

Latest commit

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

aliasmethod

Build Status

Implementation of Walker's Alias method by Rust.

The algorithm is principally useful when you need to random sampling with replacement by O(1).

Example

use rand::XorShiftRng;use aliasmethod::AliasTablelet weights = vec![1.0,1.0,8.0];let alias_table = AliasTable::new(weights)?;let rng = XorShiftRng::from_seed([189522394,1694417663,1363148323,4087496301]);let n = alias_table.random(rng);assert!(0 <= n && n <= weights.length);

About

Implementation of Walker's Alias method in Rust

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages