# `server.forbidden_api.random`: Math.random() in the rulebook

A build check error in the area "server.ts rules". An error: the game cannot be published until it is fixed.

The build check runs on every game LobbyLab builds, and each problem it finds has a stable code, the exact message, the file and line when it names one, and a link to this page.

## What the check looks at

server.ts exports `rulebook` (`init`, `advance`, `project`, and `tick` for realtime games). It must be deterministic, so the check scans the code and its strings for APIs that are not allowed.

## How to fix it

Use context.random.integer(min, maxExclusive) or the sim kit's random helpers instead of Math.random().

Use `context.random` for randomness and `context.logicalTimeMs` for time, import only named imports from the sim kit, and keep display text with words like "Date" or "global" in the client.

See also: [every error code](/docs/errors), [the API reference](/docs/api) and [the docs](/docs).
