Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

coin flip random java

import java.util.Random;
public class coinFlip {
    public static void main (String[] args){
        String[] coin = {"Tails","Heads"};
        Random random= new Random();
        int randomNumber=random.nextInt(coin.length);
        System.out.println(coin[randomNumber]);
    }
}
 
PREVIOUS NEXT
Tagged: #coin #flip #random #java
ADD COMMENT
Topic
Name
7+9 =