Add virtio-rng test util

Change-Id: Ifbd32b60d1b1d94fc851cf7bd7a28de0e158838d
diff --git a/Cargo.toml b/Cargo.toml
index af0b732..003dfd4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,5 +9,6 @@
 publish = false
 repository = "https://zircon-guest.googlesource.com/linux-tests/"
 license = "BSD-3-Clause"
+edition = "2018"
 
-[dependencies]
+[dependencies]
\ No newline at end of file
diff --git a/src/bin/virtio_rng_test_util.rs b/src/bin/virtio_rng_test_util.rs
index c567ea9..b3a61af 100644
--- a/src/bin/virtio_rng_test_util.rs
+++ b/src/bin/virtio_rng_test_util.rs
@@ -3,6 +3,23 @@
 // found in the LICENSE file.
 #![deny(warnings)]
 
-fn main() {
-    println!("PASS");
+use std::collections::HashSet;
+use std::fs::File;
+use std::io::{Error, ErrorKind, Read};
+
+fn run_test() -> std::io::Result<()> {
+    let mut set = HashSet::new();
+    let mut rng = File::open("/dev/random")?;
+    for _ in 0..8 {
+        let mut buf = vec![0; 16];
+        rng.read_exact(&mut buf)?;
+        if !set.insert(buf) {
+            return Err(Error::new(ErrorKind::Other, "Repeated random draw"));
+        }
+    }
+    Ok(())
+}
+
+fn main() -> std::io::Result<()> {
+    run_test().map(|_| println!("PASS"))
 }