X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TD1%2Fexo3%2FProducteur.java;h=d836af2a754f29d0d25d76e0413cf456cbe0e99b;hb=aee04a83cc5eecb50f85e71c4dbfc3ec2bf3cf69;hp=10eab6d55ec99bc5e25278842a1b1a5e30a6a8a6;hpb=396bc7433aa7fc3c404f2d175d1c93b82791cdde;p=TD_SR.git diff --git a/TD1/exo3/Producteur.java b/TD1/exo3/Producteur.java index 10eab6d..d836af2 100644 --- a/TD1/exo3/Producteur.java +++ b/TD1/exo3/Producteur.java @@ -1,3 +1,4 @@ +import java.util.concurrent.ThreadLocalRandom; public class Producteur implements Runnable { @@ -17,7 +18,7 @@ public class Producteur implements Runnable { System.out.println (Thread.currentThread().getName() + " a depose " + val); val++; try { - Thread.sleep((int)(Math.random()*100)); + Thread.sleep(ThreadLocalRandom.current().nextInt(101)); } catch (InterruptedException e) {} }