পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Thursday, January 19, 2017

Java.util.Random Class

Introduction

The java.util.Random class instance is used to generate a stream of pseudorandom numbers.Following are the important points about Random:

  • The class uses a 48-bit seed, which is modified using a linear congruential formula.
  • The algorithms implemented by class Random use a protected utility method that on each invocation can supply up to 32 pseudorandomly generated bits.

Class declaration

Following is the declaration for java.util.Random class:
public class Random
   extends Object
   implements Serializable

Class constructors

S.N. Constructor & Description
1 Random()
This creates a new random number generator.
2 Random(long seed)
This creates a new random number generator using a single long seed.

Class methods

S.N. Method & Description
1 protected int next(int bits)
This method generates the next pseudorandom number.
2 boolean nextBoolean()
This method returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.
3 void nextBytes(byte[] bytes)
This method generates random bytes and places them into a user-supplied byte array.
4 double nextDouble()
This method returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.
5 float nextFloat()
This method returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.
6 double nextGaussian()
This method returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.
7 int nextInt()
This method returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.
8 int nextInt(int n)
This method returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.
9 long nextLong()
This method returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.
10 void setSeed(long seed)
This method sets the seed of this random number generator using a single long seed.

Methods inherited

This class inherits methods from the following classes:
  • java.util.Object

No comments:

Post a Comment