Dear all,
It looks like the rand crate does not compile for no_std targets when the alloc feature is enabled:
$ cargo build --no-default-features --features "alloc"
Compiling rand_core v0.6.1 (/Users/michaelp/Desktop/rand/rand_core)
Compiling rand v0.8.2 (/Users/michaelp/Desktop/rand)
error[E0599]: no method named `powf` found for type `f64` in the current scope
--> src/seq/index.rs:393:40
|
393 | let key = rng.gen::<f64>().powf(1.0 / weight);
| ^^^^ method not found in `f64`
The reason is that f64::powf() and friends are not available in a no_std context.
The two options I see are to either make the functions sample_weighted and sample_efraimidis_spirakis available only when std feature is enabled, or alternatively use the pow function from the libm crate (this is what most other no_std crates like nalgebra use for their math needs).
Thank you!
Dear all,
It looks like the
randcrate does not compile forno_stdtargets when theallocfeature is enabled:The reason is that
f64::powf()and friends are not available in ano_stdcontext.The two options I see are to either make the functions
sample_weightedandsample_efraimidis_spirakisavailable only whenstdfeature is enabled, or alternatively use thepowfunction from thelibmcrate (this is what most otherno_stdcrates likenalgebrause for their math needs).Thank you!