πŸ“Š JAVA
Q. Which of the following options is the best for generating random integer 0 or 1?
  • (A) (int)Math.random()
  • (B) (int)Math.random() + 1
  • (C) (int)(Math.random() + 0.5)
  • (D) (int)(Math.random() + 0.2)
πŸ’¬ Discuss
βœ… Correct Answer: (C) (int)(Math.random() + 0.5)

Explanation: The correct answer is Option C: (int)(Math.random() + 0.5)

Explanation by: Ranjeet
The correct answer is Option C: (int)(Math.random() + 0.5)

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
98
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ranjeet
Publisher
πŸ“ˆ
81%
Success Rate