Secure Random Integer

Choose a uniformly distributed integer in an inclusive nonnegative range.

Your workspace

Processed in your browser

Enter your values or try the example.

This utility generates a cryptographically secure random integer within a user-defined inclusive range. Unlike standard pseudo-random number generators (PRNGs) often used in simulations, this tool uses the browser's cryptographically secure source of randomness.

Generating a secure integer

  1. Enter your desired minimum and maximum values. The range must be between 0 and 4,294,967,295.
  2. The tool performs rejection sampling to ensure the result is uniformly distributed across your range, preventing modulo bias.

Why use this instead of Math.random()?

Standard functions like Math.random() are not suitable for security-sensitive applications because they are predictable. This tool utilizes the Web Crypto API's getRandomValues method, which provides high-entropy, non-deterministic numbers suitable for cryptographic purposes.

Check the result

Min: 1, Max: 100

42

Questions about random number generation

What is the maximum range supported?

The tool supports any range within 0 to 4,294,967,295. This limit is imposed by the use of 32-bit unsigned integers for the underlying entropy source.

Is this suitable for gambling or lottery systems?

While this tool provides cryptographically secure numbers, it is not a certified gambling system. It is intended for general-purpose secure selection and should not be used for regulated gaming applications.

Continue your workflow

Explore more tools in this category for your next step.