← The API

Phaser AE

API docs

v3.0.0-2206 exports in 26 modulesreleased October 19, 2026

ContentsDeterministic maths

Need to get started? Install the Phaser AE CLI →

Content and maths

Deterministic maths

deterministicMath, a Math whose 22 implementation-approximated functions are ported from fdlibm and give the same bits on every engine; the module the bakery injects as every bundle's Math; installDeterministicMath() for a Node host

engine/kernel/src/math.tsengine/kernel/src/math-shim.ts

Functions

installDeterministicMath

function installDeterministicMath(): () => void

From @phaser-ae/kernel

Replace the transcendental functions on a host's own global Math with the deterministic ones, for code that no bundle reaches: a Node test, a game server running rule packs. Returns a function that puts the host's back. Never call it in a page: the page around the game would change too.

Constants

DETERMINISTIC_MATH_FUNCTIONS

const DETERMINISTIC_MATH_FUNCTIONS: ReadonlyArray<string>

From @phaser-ae/kernel

The names of the Math functions ECMAScript leaves implementation-approximated, which deterministicMath and installDeterministicMath replace. Math.random is not among them: chance comes from game.rng (Law 4).

deterministicMath

const deterministicMath: Math

From @phaser-ae/kernel

A complete Math whose transcendental functions return the same bits on every engine. Everything else (the constants, abs, sqrt, floor, min, max, imul, fround, random …) is the host's own, which ECMAScript already specifies exactly. The bakery makes this the Math of every bundle it builds.