Is there an idiomatic way of initialising arrays in Rust. I\'m creating an array of random numbers and was wondering if there is a more idiomatic way then just doing a for l
Various sized arrays can be directly randomly generated:
use rand; // 0.7.3
fn main() {
let my_array: [u64; 8] = rand::random();
println!("{:?}", my_array);
}
Currently, this only works for arrays of size from 0 to 32 (inclusive). Beyond that, you will want to see related questions: