-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
The random numbers used in the k-means clustering algorithm require calls to the WASM runtime through the JS bridge, and this slows down the execution. I propose the addition of a xorshift pseudo-random generator within the Rust code as a speed-up.
Describe the solution you'd like
Something like this:
pub struct Xorshift {
state: u32,
}
impl Xorshift {
pub fn new(seed: u32) -> Self {
Xorshift { state: seed }
}
pub fn next(&mut self) -> f64 {
self.state ^= (self.state << 13);
self.state ^= (self.state >> 17);
self.state ^= (self.state << 5);
self.state as f64 / u32::MAX as f64
}
}Describe alternatives you've considered
Leaving it as it is. It doesn't really matter.
Additional context
Нет ничего.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request