rollDoubles

Category: Programming
Author: Stuart Reges
Book Chapter: 5.1
Problem: rollDoubles
  Write a method rollDoubles that takes a Random
   object as a parameter and that prints information about a dice simulation.
   The method uses the Random object to simulate the rolling of two dice until
   doubles comes up (i.e., until the two numbers that come up are the same).
   Assume we are using standard dice that have six sides numbered 1 through 6.

   Your method should produce a sequence of simulated rolls, printing each
   roll, until the two numbers rolled match (doubles).  The numbers 1 through 6
   should be equally likely to appear for any given roll.  Your method should
   also report the total number of rolls it took to reach doubles.

   For example, if the following two calls are made after constructing a Random
   object:

        Random r = new Random();
        rollDoubles(r);
        rollDoubles(r);

   We expect to get a log of execution like this:

	Next roll = 2, 6
	Next roll = 3, 1
	Next roll = 5, 2
	Next roll = 1, 2
	Next roll = 2, 2
	Doubles after 5 rolls
	
	Next roll = 2, 6
	Next roll = 1, 4
	Next roll = 6, 2
	Next roll = 3, 3
	Doubles after 4 rolls
	
   You must exactly reproduce the format of the log above (including the blank
   lines).

   Write your solution to rollDoubles below.