Verifiable Randomness Documentation

Verifiable Randomness Systems

View the Project on GitHub blockrand-api/blockrand-js

Weighted Random Selection Without Bias

Description: How to implement rarity systems, loot tables, and weighted outcomes without introducing hidden probability errors.

The Problem

Many real-world systems require outcomes that are not equally likely.

Example:

Developers often implement this using quick heuristics that silently distort probabilities. This leads to:

Weighted randomness must be implemented precisely, or the distribution drifts over time.

What Is Weighted Randomness?

Instead of selecting uniformly from N outcomes, each outcome has a weight.

Example:

Total weight: 70 + 25 + 5 = 100

Probability of each:

The goal is to select an outcome proportional to its weight.

The Most Common Incorrect Implementation

Typical mistake:

  1. Generate random integer 0–100
  2. Map ranges manually

Problems:

Even small mistakes produce measurable bias over thousands of draws.

Correct Method: Cumulative Distribution

Step 1 — Define weights

Common = 70 Rare = 25 Legendary = 5

This guarantees perfect proportionality.

Why This Matters in Production Systems

Loot Economies

A 1–2% drift:

Gambling & Compliance

Weighted outcomes must be:

Incorrect implementations can:

Live Service Games

Small bias × millions of events =

Most “rigged RNG” accusations come from bad weighted selection.

Common Engineering Mistakes

Using Floating Point

Float rounding causes:

Use integers only.

Renormalizing Every Draw

Changing total weight dynamically:

Editing Tables Without Versioning

Changing weights without:

Deterministic Auditability Pattern

Inputs:

Process:

  1. Hash inputs
  2. Derive 64-bit integer
  3. Map via rejection sampling
  4. Select from cumulative weights

Result: Anyone can recompute the exact selection.

Key Takeaway

Weighted randomness is not just picking from ranges. Correct implementation requires:

If any step is wrong, the distribution becomes statistically provable as unfair.

Where This Is Used

Weighted selection is one of the most economically sensitive parts of any randomness system.