Java Random nextBoolean() MethodThe nexBooleant() method of Random class returns the next pseudorandom, uniformly distributed boolean value from the random number generator's sequence. SyntaxParametersNA Return ValueThe nextBoolean () method returns the next pseudorandom boolean value. Example 1Test it NowOutput: Random booleanvalue : false Random booleanvalue : true Example 2Test it NowOutput: For Head: enter true. For tail : enter false Enter your choice : false Outcome is : false Congratulations!!You won the round!
Next TopicJava Random
|