Skip to reading
PCA Script Programming

random_number() and aliases

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page
On this page
Code example
random_number(minimum = 0, maximum = 1)

Choose a random floating-point value in the supplied range.

Returns: Number.

Aliases: random_float()

Code example
random_number(0.25, 0.75)

With one argument, it is the minimum and the maximum remains 1. Use two arguments for clarity.

randomize()#

Code example
randomize(seed_value?)

Reseed the shared random generator. Omit the seed for normal varied play; pass a seed for reproducible tests.

Returns: Null.

Code example
randomize(1234)

The generator is shared with other random work. Do not reseed on every roll.

choose()#

Code example
choose(values, fallback = null)

Pick one entry from an array.

Returns: Selected value; fallback for an empty/non-array value.

Code example
choose(["Locked.", "Still locked."], "No reply.")
Page 56 of 357Permalink
Go to page