import java.util.Random;
public class CoinSimulation {
public void simulation() {
Random rand = new Random();
int a = rand.nextInt(2);
if(a==0) {
System.out.println("正面");
}else {
System.out.println("反面");
}
}
public static void main(String[] args) {
CoinSimulation coin = new CoinSimulation();
for(int i =0;i<10;i++) {
coin.simulation();
}
}
}
模拟硬币正反