Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. use rand::prelude::*;
  2. use std::thread;
  3.  
  4.  
  5. fn main() {
  6.  
  7. for i in 1..8 {
  8. thread::spawn(move || {
  9. let mut rng = rand::thread_rng();
  10. let thread: u8 = i;
  11. let mut j: u128 = 0;
  12. let mut x: f64 = 0.0;
  13. let mut y: f64 = 1.0;
  14. while x != y {
  15. println!("thread: {}, j: {}, x: {}, y: {}", thread, j, x, y);
  16. j += 1;
  17. x = rng.gen();
  18. y = rng.gen();
  19. }
  20. });
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement