Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

rock paper scissors java

import java.util.Random;

public class RandomComputerPlayer implements RPSPlayer {
    private final Random random;

    public RandomComputerPlayer(Random random) {
        this.random = random;
    }

    public String play() {
        return CHOICES[this.random.nextInt(CHOICES.length)];
    }
}
Source by codereview.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #rock #paper #scissors #java
ADD COMMENT
Topic
Name
3+8 =