Rigged lottery
JavaScript
// Random number generator
function mulberry32(a) {
const p1 = 1667;
const p2 = 3037;
a = Math.round(Math.random() * Number.MAX_SAFE_INTEGER * (a % p2 + a % p1)) + 18055129;
return function () {
a |= 0;
a = a + 0x6D2B79F5 | 0;
let t = Math.imul(a ^ (a >>> 15), 1 | a);
t ^= t + Math.imul(t ^ (t >>> 7), 61 | t);
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
function runLottery(date) {
const iso = new Date(date).toISOString().slice(0, 10);
const rand = mulberry32(Number(iso.replace(/\D/g, '')));
const balls = new Set();
while (balls.size < 5) {
balls.add(1 + Math.floor(rand() * 69));
}
const powerball = 1 + Math.floor(rand() * 26);
console.log(`[${iso}] And today's numbers are: ${[...balls].join(', ')}, and the powerball: ${powerball}.`);
}
// Just run it on a few dates to test
runLottery('2025-07-15'); // [2025-07-15] And today's numbers are: 23, 19, 60, 51, 39, and the powerball: 11.
runLottery('2025-07-15'); // [2025-07-15] And today's numbers are: 69, 9, 8, 49, 7, and the powerball: 25.
runLottery('2025-07-16'); // [2025-07-16] And today's numbers are: 19, 1, 16, 11, 33, and the powerball: 15.
runLottery('2025-07-16'); // [2025-07-16] And today's numbers are: 19, 1, 16, 11, 33, and the powerball: 15.
runLottery('2025-07-17'); // [2025-07-17] And today's numbers are: 62, 10, 33, 29, 68, and the powerball: 9.
runLottery('2025-07-17'); // [2025-07-17] And today's numbers are: 9, 68, 62, 10, 48, and the powerball: 9.