• Courses
  • Code Compiler
  • Discuss
  • Pricing
  • Teams
Menu
+ 2

Random in java

Can someone explain me the random method

java
10th Sep 2017, 6:56 AM
Pankaj Bairwa
Pankaj Bairwa - avatar
2 Answers
+ 14
Math.random() or Random class? https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#random-- https://docs.oracle.com/javase/8/docs/api/java/util/Random.html
10th Sep 2017, 7:03 AM
Tashi N
Tashi N - avatar
+ 10
Don't forget java.util.concurrent.ThreadLocalRandom https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadLocalRandom.html
10th Sep 2017, 7:10 AM
ChaoticDawg
ChaoticDawg - avatar

Often have questions like this?

Learn more efficiently, for free:

  • Introduction to Python

    7.1M learners

  • Introduction to Java

    4.7M learners

  • Introduction to C

    1.5M learners

  • Introduction to HTML

    7.5M learners

See all courses
Hot today
HTML
3 Votes
Functions in python
2 Votes
Answer please
0 Votes
For Mobile app
0 Votes
How can you find whether a number is odd or even in a different way(other than (x%2==0))?
1 Votes
I need advice
0 Votes
this query always result to be incorrect from Sorting Data lesson
1 Votes
I need advice
0 Votes
Html 5 document question
1 Votes
Paint costs
1 Votes