Languages
[Edit]
EN

Java - get random long

10 points
Created by:
Warren-X
443

1. Generate random long with ThreadLocalRandom

Edit

Example:


2. Generate random long with Random

Edit

Example:


3. Generate random long with Random and LongStream

Edit

Example:


If we want to generate random long in range look into post:
https://dirask.com/q/zjM8wp


References

Edit

ThreadLocalRandom - Java docs
Random - Java docs
LongStream - Java docs

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Java - random numbers

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join