I am trying to populate a vector with random numbers using web_sys crate
Something like this :
extern crate web_sys;
use web_sys::Crypto;
// ...
fn main() {
// ...
let mut arry = [0u8; 128];
let crypto = Crypto::new();
crypto.get_random_values_with_u8_array(&mut arry)
// ...
}
The Crypto struct however does not implement new methods and docs do not mention the fields needed to instantiate the the struct.
I've included Crypto as feature in my Cargo.toml file:
[dependencies.web-sys]
version = "0.3"
features = [
"Crypto"
]
Here's the relevant docs page:
https://docs.rs/web-sys/0.3.35/i686-unknown-linux-gnu/web_sys/struct.Crypto.html
Does anyone have experience using this?