Advertisement
mmayoub

Die, 10.07.2021

Jul 10th, 2021
902
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. package prj10072021;
  2.  
  3. import java.util.Random;
  4.  
  5. public class Die {
  6.     private int num;
  7.     static private Random rnd=new Random();
  8.    
  9.     public Die()
  10.     {
  11.         //this.rnd = new Random();
  12.         roll();
  13.     }
  14.    
  15.     public void roll() {
  16.         //this.rnd = new Random();
  17.         this.num=1+Die.rnd.nextInt(6);
  18.     }
  19.    
  20.     public int getNum() {
  21.         return this.num;
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement