```  /*
Die Rolling Example II
April 21, 1996
*/

import ec.e.run.EInteger;
import java.util.Random;

public class DemoRoller
{
public static void main(String args[]) // Step 1
{
DieRoller rollerOne = new DieRoller(); // Step 2
DieRoller rollerTwo = new DieRoller(); // Step 3

EInteger rollerOneHash, rollerOneX; // Step 4
EInteger rollerTwoHash, rollerTwoX; // Step 5

rollerOne <- doDieRoll(&rollerOneHash, &rollerOneX,
rollerTwoHash, rollerTwoX); // Step 6

rollerTwo <- doDieRoll(&rollerTwoHash, &rollerTwoX,
rollerOneHash, rollerOneX); // Step 7
} // Step 8 (main is finished)
}

eclass DieRoller
{
Random randomGenerator = new Random();

emethod doDieRoll(EDistributor myHash, EDistributor myX,
EInteger hisHash, EInteger hisX) // Step 09, Step 10
{

long X = randomGenerator.nextLong(); // Step 11

myHash <- forward(new EInteger(OneWayHash(X))); // Step 12

ewhen hisHash (long otherHash) // Steps 13-18
{
myX <- forward(new EInteger(X)); // Step 19

ewhen hisX (long otherX) // Steps 20-24
{
long finalResult = Combine(X, otherX); // Step 25

System.out.println("Roll result = " + finalResult);

if (OneWayHash(otherX) != otherHash) {
System.out.println("There was cheating.");
}
}
}
}

long OneWayHash(long a) /* Placeholder function */
{
return (a);
}

long Combine(long a, long b)
{
return (((a ^ b) % 6) + 1);
}
}

```