Closed
Description
The test program in the ndarray-rand documentation doesn't compile with rand 0.7:
main.rs:
use ndarray::Array;
use ndarray_rand::RandomExt;
use rand::distributions::Uniform;
fn main() {
let a = Array::random((2, 5), Uniform::new(0., 10.));
println!("{:8.4}", a);
}
cargo.toml:
[package]
name = "rand-test"
version = "0.1.0"
authors = ["Nathan Goldbaum <nathan12343@gmail.com>"]
edition = "2018"
[dependencies]
ndarray = { version = "0.12", features = ["blas"] }
ndarray-rand = "0.9"
rand = "0.7"
compile error:
Updating crates.io index
Compiling rand-test v0.1.0 (/home/goldbaum/Documents/rand-test)
error[E0277]: the trait bound `rand::distributions::uniform::Uniform<{float}>: rand::distributions::Distribution<_>` is not satisfied
--> src/main.rs:6:13
|
6 | let a = Array::random((2, 5), Uniform::new(0., 10.));
| ^^^^^^^^^^^^^ the trait `rand::distributions::Distribution<_>` is not implemented for `rand::distributions::uniform::Uniform<{float}>`
|
= note: required by `ndarray_rand::RandomExt::random`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
error: Could not compile `rand-test`.
It works if I specify rand = "0.6"
in cargo.toml.
Apologies if this issue is documented already and I've missed it.