1 use test_programs::p3::wasi::random;
2 
3 struct Component;
4 
5 test_programs::p3::export!(Component);
6 
7 impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
run() -> Result<(), ()>8     async fn run() -> Result<(), ()> {
9         test_big_random_buf().await;
10         Ok(())
11     }
12 }
13 
main()14 fn main() {
15     unreachable!()
16 }
17 
test_big_random_buf()18 async fn test_big_random_buf() {
19     let buf = random::random::get_random_bytes(1024);
20     // Chances are pretty good that at least *one* byte will be non-zero in
21     // any meaningful random function producing 1024 u8 values.
22     assert!(buf.iter().any(|x| *x != 0), "random_get returned all zeros");
23 }
24