Rnd

From WikiManual
Jump to: navigation, search

Operators:

Basic Commands:

add & sub
mult & div
rnd
*
mod
sgn
abs

Overview

The operator generates a random number.

Use

State the maximal desired number. The operator will generate a random number between 0 and the specified maximal desired number. The random number is placed on the top of the stack.

Example:

10 rnd 50 store

This stores a random number from 0 -10 in memory location 50.

This is most often used in combat sims to:

  • generate different actions per cycle (1 rnd)
  • randomize turning radius
  • randomize number stored into .tie

Uses in Evolution

Several bots have been observed using the rnd operator in evolution sims. Presumably this allows the bot access to more memory locations and therefore a wider range of behaviors with little additional code.