random

Pseudo-random integers. The sequence is the same on every run unless you seed it, so seed from something that varies, such as how long the player waits at a title screen:

from ti84 import keyboard, random

ticks = 0
while not keyboard.get():
    ticks += 1
random.seed(ticks)

These numbers are not suitable for anything that must be unpredictable.

Methods

seed(value)

Seed the random number generator.

Targets:

CE, Classic, Flash App

Flash App form:

seed(seed)

random.seed(x)
randrange(limit) → int

Random integer from 0 to limit - 1.

Targets:

CE, Classic, Flash App

z = random.randrange(x)
randint(low, high) → int

Random integer from low to high inclusive.

Targets:

CE, Classic, Flash App

z = random.randint(x, y)