How to generate random numbers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to generate random numbers?

I want to ask that can we generate random numbers in Java without any predefined classes (such as Random.class) and writing the code manually. If anyone can please attach your code in your answer.

22nd Aug 2018, 2:46 PM
Krishna Kumar
Krishna Kumar - avatar
2 Answers
+ 5
I suggest you search for "pseudorandom number generator" for a more general algorithm.
22nd Aug 2018, 3:23 PM
Eduardo Petry
Eduardo Petry - avatar
0
You should be able to create a pseudo random number generator rather easily. Hint - use the tiniest fractions of current time.
22nd Aug 2018, 11:08 PM
Erom
Erom - avatar