A

Admin • 831K Points
Coach

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)
  • Correct Answer - Option(C)
  • Views: 18
  • Filed under category Java
  • Hashtags:

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

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.