Last updated
Random Number Generator Examples
The Random Number Generator creates random numbers with full control over range, quantity, format, and distribution. Below are practical examples for common use cases.
Basic Range Generation
Generate a single integer between 1 and 100:
Range: 1 to 100
Result: 47
Simple range generation is the most common use case — useful for percentage values, scores, and general-purpose random integers.
Dice Simulation
Simulate rolling a standard six-sided die:
Range: 1 to 6
Result: 4
For a pair of dice, generate two numbers in the same range and sum them. Range 2–12 with two dice gives a realistic bell-curve distribution.
Decimal Numbers
Generate a price value with two decimal places:
Range: 0.01 to 999.99
Decimal places: 2
Result: 47.83
Decimal generation is useful for prices, measurements, and any value requiring specific precision.
Negative Number Ranges
Generate a temperature value in Celsius:
Range: -40 to 50
Result: -12
Negative ranges work the same as positive ones. Useful for testing applications that handle temperatures, financial losses, or coordinate offsets.
Unique Number Set (No Duplicates)
Generate 6 unique lottery numbers from 1 to 49:
Range: 1 to 49
Quantity: 6
Unique: yes
Result: 3, 17, 22, 31, 38, 45
Unique generation is essential for lottery simulations, random sampling without replacement, and generating unique identifiers.
Bulk Generation — List Format
Generate 10 random integers for test data:
Range: 1 to 1000
Quantity: 10
Format: list
Output:
742
89
315
601
27
488
153
876
44
290
Bulk Generation — CSV Format
Generate numbers in CSV format for database import:
742,89,315,601,27,488,153,876,44,290
Bulk Generation — JSON Array
Generate numbers as a JSON array for use in code:
[742, 89, 315, 601, 27, 488, 153, 876, 44, 290]
Normal (Gaussian) Distribution
Generate test scores following a bell curve:
Distribution: Normal
Mean: 70
Standard deviation: 10
Quantity: 20
Sample output:
68, 74, 61, 82, 70, 65, 77, 73, 58, 80,
71, 66, 75, 69, 83, 62, 78, 72, 67, 76
Normal distribution generates numbers clustered around the mean, matching how real-world measurements like test scores, heights, and response times behave.
Cryptographically Secure Random Numbers
Generate a secure token value using the Web Crypto API:
Mode: Cryptographic
Range: 0 to 4294967295 (32-bit max)
Result: 2847392015
Cryptographic mode uses hardware entropy sources and is suitable for generating tokens, keys, and other security-sensitive values that must be unpredictable.
Seed-Based Reproducible Generation
Generate the same sequence every time for reproducible tests:
Seed: 42
Range: 1 to 100
Quantity: 5
Result: 13, 67, 29, 84, 51
Using the same seed always produces the same sequence. This is useful for debugging issues that only appear with specific random inputs and for sharing reproducible test scenarios.
Statistical Verification
After generating 1000 numbers (range 1–100, uniform), verify distribution:
Min: 1
Max: 100
Mean: 50.3
Median: 50
Std Dev: 28.9
Distribution: uniform (histogram shows even spread)
Statistical analysis confirms the generator is working correctly for your configuration.
Large-Scale Testing
Generate 1,000,000 numbers for performance testing:
Range: 1 to 1,000,000
Quantity: 1,000,000
Format: CSV
Export: numbers.csv
Bulk generation at scale is useful for load testing, performance benchmarking, and populating large test datasets.
- Set any numeric range including negative numbers and decimals
- Control decimal precision for prices and measurements
- Generate unique sets with no duplicates
- Choose uniform or normal (Gaussian) distribution
- Use cryptographic mode for security-sensitive values
- Use seed-based mode for reproducible test sequences
- Export as list, CSV, JSON array, or SQL format
- Verify distribution with built-in statistical analysis