Randomness Visualizer
Overview
The Randomness Visualizer provides multiple ways to visualize random number sequences through bitmaps, noise patterns, RGB pixels, spirals, and 3D scatter plots. Visual inspection can reveal patterns, biases, and quality issues that statistical tests might miss. Compare different random number generators including Math.random(), LCG, Mersenne Twister, and XorShift, analyze Shannon entropy, and use animation mode to spot temporal patterns in the sequences.
Tips and Tricks
Getting Started
- Select a visualization type to see different representations of randomness
- Choose an RNG algorithm to test (start with Math.random())
- Click “Generate” to create the visualization
- Look for patterns - good RNGs should show no visible structure
Understanding Visualizations
Random Bitmap - Black and white pixel noise - should appear completely uniform - Any visible lines, patterns, or structures indicate problems - Best for: Quick visual assessment of basic randomness
Perlin-like Noise - Smooth, interpolated noise that creates natural-looking patterns - This intentionally creates structure (not pure randomness) - Best for: Understanding the difference between random and pseudorandom
RGB Pixel Noise - Full-color noise with independently randomized RGB channels - Should show even color distribution without banding - Best for: Detecting channel-specific biases
Spiral Pattern - Plots random values along a spiral path - Makes periodicities and patterns easier to spot - Best for: Detecting hidden periodicities in the sequence
3D Scatter Cloud - Plots triplets of consecutive random numbers in 3D space - Should uniformly fill the cube with no visible planes or lines - Best for: Detecting correlations between consecutive values - Tip: Rotate the view to check from different angles
Entropy Analysis
Shannon Entropy measures the information content and unpredictability:
- High entropy: Data is random and unpredictable (good)
- Low entropy: Data contains patterns and redundancy (bad)
- Maximum: For 256 bins, max entropy = 8 bits
Interpreting Values: - 7.8 - 8.0 bits: Excellent randomness - 7.0 - 7.8 bits: Good but some minor patterns - Below 7.0 bits: Significant patterns detected
Practical Tips
Testing RNGs: - Start with the bitmap view for quick assessment - Use 3D scatter to check for correlations - Enable animation to check temporal stability - Compare multiple RNG algorithms side-by-side
What to Look For: - Vertical/horizontal lines: Indicates low-bit correlation - Diagonal patterns: Suggests linear relationships - Planes in 3D: Serial correlation between consecutive values - Color banding in RGB: Channel-specific biases - Regular spacing in spiral: Periodicity in the sequence
Common Issues: - LCG showing planes: Expected - LCGs have known lattice structure - Math.random() varies: Browser implementation-dependent - Patterns in animation: Temporal correlation issues
Advanced Usage
Comparing Algorithms: 1. Generate the same visualization for different RNGs 2. Note which show patterns and which don’t 3. Save images for documentation
Custom Testing: - Use image export to save visualizations - Test with different sample sizes - Combine with statistical tests for comprehensive evaluation
Art and Design: - Use Perlin noise for textures - Export RGB noise for procedural art - Experiment with different algorithms for varied aesthetics