This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate futures; | |
extern crate futures_cpupool; | |
extern crate rand; | |
use futures::{Future, Sink, Stream}; | |
/// Sleep for a random time between 0 and 1 second. | |
fn sleep_random() { | |
let sleep_time_ms = rand::random::<u8>() as f64 / 255.0 * 1000.0; | |
std::thread::sleep(std::time::Duration::from_millis(sleep_time_ms as u64)); |