Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.ArrayList;
- /**
- * Write a description of class RandomTester here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class RandomTester
- {
- // instance variables - replace the example below with your own
- private int x;
- Random randomGenerator;
- Private ArrayList<String> responces;
- /**
- * Constructor for objects of class RandomTester
- */
- public RandomTester()
- {
- // initialise instance variables
- x = 0;
- randomGenerator = new Random();
- responces = new ArrayList<String>();
- }
- /**
- * An example of a method - replace this comment with your own
- *
- * @param y a sample parameter for a method
- * @return the sum of x and y
- */
- public int sampleMethod(int y)
- {
- // put your code here
- return x + y;
- }
- public void printNewRandom()
- {
- int index = randomGenerator.nextInt();
- System.out.println(index);
- }
- public void printMultiRandom(int howMany)
- {
- int index = 0;
- {
- while(index < howMany)
- {
- System.out.println(randomGenerator.nextInt());
- index++;
- }
- }
- }
- public int throwDice()
- {
- int index = randomGenerator.nextInt(6);
- {
- return index+1;
- }
- }
- public String getResponse()
- {
- int index = randomGenerator.nextInt(3);
- {
- if (index == 0)
- {
- return "yes";
- }
- if(index == 1)
- {
- return "no";
- }
- if(index == 2)
- {
- return "maybe";
- }
- else
- {
- return "null";
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment