Skip to content

Zenkai Opcode StackRand

Johnathon edited this page Sep 16, 2026 · 1 revision

StackRand

Pops the upper bound and pushes a random value below it.

Syntax

StackRand(max)

Parameters

max
Integer
Exclusive upper bound.

Remarks

Pushes a random integer in [0, max) onto the VM stack.

Pops the upper bound and pushes a random value below it. Use with JumpIfFalse/comparisons for branching scripts (e.g. random encounter chance).

Examples

Minimal illustrative encoding (synthetic, not from a real ROM script):

0x00, N           // PushByte(max)
0x02, 0x11        // Step -> BytecodeVM_StackRand

See Also

Applies To

Game Notes
Legacy of Goku 2 Supported

Clone this wiki locally