Open source August 2026 /9 pages
Lararand

Lararand

Lararand

Lararand gives Laravel randomness whose source is a config line: quantum vacuum noise measured at the Australian National University, atmospheric noise from random.org, or the machine's own CSPRNG. Nothing that draws, shuffles or deals ever learns which one it got.

'chain' => ['anu_public', 'system'],

That is the whole setup. anu_public is the ANU's free endpoint and needs no account.

Why not just random_int

Most of the time you should. random_int is the system CSPRNG, it is what every session id on the box already rests on, it costs nothing and it cannot be down.

This package exists for the case where the origin of the randomness is part of what you are selling: a draw someone could contest, a shuffle a regulator asks about, a product whose whole claim is that nobody arranged the outcome. "Our lottery runs on quantum vacuum noise" is a sentence you can put in front of a customer. "We called random_int" is not, even though it is a fine answer.

And once you have written that sentence you need the rest of this package. A remote generator will be down, rate limited or slow, and a draw that fails in front of a customer is worse than one drawn locally.

What it does

use EduLazaro\Lararand\Facades\Rand;

Rand::below(78);            // 0 to 77
Rand::distinct(6, 49);      // six of 49, no repeats
Rand::shuffle($deck);       // a permutation
Rand::one($items);

Three things, in the order they matter.

The source is configuration. Swapping a quantum generator for the CSPRNG is one line, and no calling code changes. There is one contract and it returns bytes; everything else is derived by the package.

A provider being down never costs you a draw. Sources are a chain tried in order, with a cooldown shared across workers so one of them learning the quota is gone spares the rest, and a buffer so dealing seven cards is one request rather than eight.

The arithmetic is done once, and correctly. Turning bytes into a number in a range is where the bug lives, and it is a silent one: $byte % 78 looks right, passes every range check, and gives a third of the deck a 33% edge forever.

Installation

composer require edulazaro/lararand
php artisan vendor:publish --tag=lararand-config

Out of the box the chain is ['system'], so it uses the machine's CSPRNG and nothing leaves the box.