Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Dealing with Randomness - Part I

Here's an example of a Java unit test that verifies the behavior of a coin-flipping Bernoulli trial:

import org.testng.annotations.Test;
import java.util.Random;
import static org.testng.Assert.*;
class CoinFlipper {
public enum Face {HEAD, TAIL}
private final Random random = new Random();
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content