0% found this document useful (0 votes)
10 views1 page

Class Notes 1

Uploaded by

gabrielgongora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Class Notes 1

Uploaded by

gabrielgongora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

What is java.util.Random class in Java?

The java.util.Random class is used to generate pseudorandom numbers. The


methods implemented by this class are used to generate different random data types
such as int, double, and float. So there are two major types of random numbers,
statistically random and pseudorandom numbers. The statistically random numbers
(like simple random numbers in maths), are a set of values that do not have a
recognizable pattern. For example, rolling a dice 10 times will generate a random
number each time that does not have any recognizable pattern.
What are Pseudo Random Numbers?
It is a set of values that are statistically random but have a known starting
point. In Java, each pseudorandom number is produced through an algorithm. So
typically a cycle is repeated every time java.util.Random generates a random
number. A random number generator in Java will produce statistically random
numbers but with a known starting point, generated by an algorithm. That makes
those values pseudorandom.
Is java.util.Random class Cryptographically Insecure?
It is cryptographically insecure because it has algorithms implemented for
generating random numbers. As a result of which a person knowing how the
algorithm works will not take much time accessing your sensitive data. So if you are
working with some security applications, needed to secure some sensitive data, or
need to generate random passwords then it's better to avoid using this class. It is
helpful in many cases like generating a random number for your dice roll in ludo,
gambling, doing a toss for a match or other areas where your desired result is
unpredictable.

You might also like