Advertisement
mmayoub

Die.cs

Dec 22nd, 2021
1,127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace PointExercise
  6. {
  7.     class Die
  8.     {
  9.         private Random rnd;
  10.         private int num;
  11.  
  12.         public Die()
  13.         {
  14.             rnd = new Random();
  15.             num = rnd.Next(1, 7);
  16.         }
  17.  
  18.         public void Roll()
  19.         {
  20.             num = rnd.Next(1, 7);
  21.         }
  22.  
  23.         public int getNum()
  24.         {
  25.             return num;
  26.         }
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement