Description
Hello,
I've been working on creating a reproducible random array for testing variations on a neural network architecture, and came across a bit of an issue with trying to instantiate an Array using the Isaac64 RNG, which seems like it should be supported by the crate. Per the docs, I tried building the listed example in a stand-alone project, with the following in main.rs
use ndarray::Array;
use ndarray_rand::RandomExt;
use ndarray_rand::rand::SeedableRng;
use ndarray_rand::rand_distr::Uniform;
use rand_isaac::isaac64::Isaac64Rng;
fn main() {
// Get a seeded random number generator for reproducibility (Isaac64 algorithm)
let seed = 42;
let mut rng = Isaac64Rng::seed_from_u64(seed);
// Generate a random array using `rng`
let a = Array::random_using((2, 5), Uniform::new(0., 10.), &mut rng);
println!("{:8.4}", a);
}
and this in my Cargo.toml
file.
[dependencies]
ndarray = "0.13"
ndarray-rand = "0.13"
rand = "0.8"
rand_isaac = "0.3"
However, each time I receive
error[E0599]: no function or associated item named `random_using` found for struct `ArrayBase<OwnedRepr<_>, _>` in the current scope
--> src/main.rs:13:20
|
13 | let a = Array::random_using((2, 5), Uniform::new(0., 10.), &mut rng);
| ^^^^^^^^^^^^ function or associated item not found in `ArrayBase<OwnedRepr<_>, _>`
I've tested this behavior using both rustc 1.48.0 (7eac88abb 2020-11-16)
and rustc 1.51.0-nightly (0b644e419 2020-12-26)
. I didn't see a test in ndarray/ndarray-rand/tests/test.rs
that covers the random_using()
function, which means this error may have been missed by CI, although it's certainly possible that I may have missed something.
I'd be happy to test any corrections, and I have find the time, I may be able to dig into this an submit a PR fixing, although I have a few other things on my plate before I can get there. Thanks, and hope your holidays have been well!