Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
How to generate random number in java?
Home
JAVA
How to generate random number in java?
0
votes
asked
Oct 19, 2020
in
JAVA
by
rahuljain1
How to generate random number in java?
#random-number-in-java
#java-random-number
Java-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Oct 19, 2020
by
sharadyadav1986
How to generate random number in java?
public static double getRandomNumber(){
double x = Math.random();
return x;
}
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
+1
vote
Q: How to generate random number in scripts like R/PY?
asked
Nov 29, 2019
in
Machine Learning
by
SakshiSharma
#random-number
Machine-Learning-questions-answers
+1
vote
Q: Write a program to generate the following output in java?
asked
Oct 24, 2020
in
JAVA
by
sharadyadav1986
#star-program-java
#star-program
Java-questions-answers
0
votes
Q: How to reverse a number in java?
asked
Oct 18, 2020
in
JAVA
by
sharadyadav1986
#reverse-a-number
#reverse-number-in-java
#java-reverse-number
Java-questions-answers
0
votes
Q: How to count the number of occurrences of a character in a string in java?
asked
Oct 11, 2020
in
JAVA
by
SakshiSharma
#count-the-number
#character-in-string-i-java
#java-string-character
Java-questions-answers
0
votes
Q: Write a Java program to count the number of words present in a string?
asked
May 4, 2021
in
JAVA
by
SakshiSharma
#java-program
java
Java-questions-answers
+1
vote
Q: Write a program to calculate the factorial of a number in java.
asked
Oct 23, 2020
in
JAVA
by
rahuljain1
#calculate-factorial
#program-factorial
#factoria-program
Java-questions-answers
0
votes
Q: Prime Number Program in Java
asked
Nov 25, 2020
in
JAVA
by
SakshiSharma
#prime-number-in-java
#java-prime-number
Java-questions-answers
0
votes
Q: Compact Number Formatting JAVA 12 feature
asked
Jan 10, 2020
in
JAVA
by
DavidAnderson
Java-questions-answers
0
votes
Q: Which package contains the Random class?
asked
Apr 8, 2021
in
JAVA
by
SakshiSharma
java
java-questions-and-answers
java-mcq
core-java-mcq
java-multiple-choice-questions
java-questions-2021
java-interview-questions
java-advanced-questions
Java-questions-answers
0
votes
Q: Can we use random numbers in the hashcode() method?
asked
Jan 27, 2020
in
JAVA
by
rahuljain1
#java-hashcode
Java-questions-answers
...