Languages
[Edit]
EN

JavaScript - generate random long value as string (without BigInt usage)

8 points
Created by:
Blessing-D
574

In this short article, we would like to show how in simple way generate random long value as string using JavaScript.

Note: as long value we understand signed 64 bits integer value (from -9223372036854775808 to 9223372036854775807).

Quick solution:

Note: the above solution doesn't use BigInt type that makes it working in the older JavaScript engines.

 

See also

Edit
  1. JavaScript - random long value

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.
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