BMath.GetRndInt( )

BMath.GetRndInt() - generate a random integer with a min and max value.

( Brutus2D 1.6, 1.7 )

Syntax

number = BMath.GetRndInt ( lowValue, highValue )

  • lowValue - the minimum value that a number can have
  • highValue - the maximum value that a number can have
  • number - a random number between lowValue and highValue

Description

BMath.GetRndInt() generates a random integer number in a range between lowValue and highValue including the two. There is no requirement that lowValue be less then highValue as this is taken care of within the function. The random generator should be seeded before using this function with Randomize.

Examples

Simulate a Six-Sided Die

The example below simulates the random number of a six-sided die roll.

Dim dieRoll
dieRoll = BMath.GetRndInt(1,6)

Related Pages

Backlinks

These pages link back to this one. You may find them helpful.

page tags: integer math random
page_revision: 4, last_edited: 1215148081|%e %b %Y, %H:%M %Z (%O ago)