Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package punto_2;
- import java.util.Random;
- public class GenerarCliente extends Thread {
- private Buffer buffer;
- private final int maxTiempo = 1500;
- private final int minTiempo = 800;
- public GenerarCliente(Buffer b) {
- this.buffer = b;
- }
- public void run() {
- Random r = new Random();
- while (true) {
- int tiempo = r.nextInt((maxTiempo - minTiempo) + 1) + minTiempo;
- try {
- sleep(tiempo);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- Thread cliente = new Cliente(this.buffer);
- cliente.start();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement