posted Oct 10, 2013, 3:05 AM by Samuel Konstantinovich   [ updated Oct 11, 2013, 12:30 PM ]
I always tell my students that sleeping more means they can study less. You ignore me. 
After you read this article, if you still think your sleeping habits lead to success then you are just telling me you don't want to do better in life (and school). 

You should have code like this already:

import java.util.Random;
public class randomTest{
    public static void main(String[]args){
Random numberMaker=new Random();

int min = 999;
int max = 1;
int current;
int count = 0;
while(count < 100){
   current = numberMaker.nextInt(999) + 1;
   if(current < min){
min = current;
   if(current > max){
max = current;
System.out.println("min:" + min);
System.out.println("max:" + max);

boolean top = false,bottom = false;
int counter = 0;
while(! top || ! bottom){
   int now = numberMaker.nextInt(999) + 1;
   if(now == 999)
top = true;
   if(now == 1)
bottom = true;


In class and at home: Modify your randomTester program in the following ways:

Make your randomTester an object that can be instantiated. You should write a main to test it in the following way (pseudocode:)
       print testA()
       print testB()

It should have the following methods

//test a runs the test 100 times by default from 1-999
String testA()
//parameters can change the 1 the 999 and the 100 as you see fit:
String testA(int min,int max, int numTimes)

TestA should return a string with both answers. e.g. "min=32,max=999"

//testB calculates random integers from 1-999 until the min and max value are found. 
int testB()
//parameters can be used to change the 1 and the 999:
int testB(int min,int max)

TestB should return the integer representation of how many times were required.