Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use rand::prelude::*;
- use std::thread;
- fn main() {
- for i in 1..8 {
- thread::spawn(move || {
- let mut rng = rand::thread_rng();
- let thread: u8 = i;
- let mut j: u128 = 0;
- let mut x: f64 = 0.0;
- let mut y: f64 = 1.0;
- while x != y {
- println!("thread: {}, j: {}, x: {}, y: {}", thread, j, x, y);
- j += 1;
- x = rng.gen();
- y = rng.gen();
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement