Dice

indigo.shared.dice.Dice
See theDice companion object
trait Dice

The Dice primitive supplies a consistent way to get psuedo-random values into your game.

A dice instance can be found in the FrameContext object with 'max int' sides, and every frame the dice's seed value is set to the current running time of the game in milliseconds.

Dice also serve as a handy proxy to a number of functions found on a normal Random instance, like alphanumeric, but with a predicatable seed.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def roll: Int

Roll an Int from 1 to the number of sides on the dice (inclusive)

Roll an Int from 1 to the number of sides on the dice (inclusive)

Attributes

def roll(sides: Int): Int

Roll an Int from 1 to the specified number of sides (inclusive), using this dice instance as the seed.

Roll an Int from 1 to the specified number of sides (inclusive), using this dice instance as the seed.

Attributes

def rollAlphaNumeric(length: Int): String

Produces an alphanumeric string of the specified length

Produces an alphanumeric string of the specified length

Attributes

def rollAlphaNumeric: String

Produces an alphanumeric string 16 characters long

Produces an alphanumeric string 16 characters long

Attributes

def rollDouble: Double

Produces a random Double from 0.0 to 1.0

Produces a random Double from 0.0 to 1.0

Attributes

def rollFloat: Float

Produces a random Float from 0.0f to 1.0f

Produces a random Float from 0.0f to 1.0f

Attributes

def rollFromZero: Int

Roll an Int from 0 to the number of sides on the dice (inclusive)

Roll an Int from 0 to the number of sides on the dice (inclusive)

Attributes

def rollFromZero(sides: Int): Int

Roll an Int from 0 to the specified number of sides (inclusive), using this dice instance as the seed.

Roll an Int from 0 to the specified number of sides (inclusive), using this dice instance as the seed.

Attributes

def rollRange(from: Int, to: Int): Int

Roll an Int from the range provided (inclusive), using this dice instance as the seed.

Roll an Int from the range provided (inclusive), using this dice instance as the seed.

Attributes

def seed: Long

The seed value of the dice. The dice supplied in the FrameContext has the seed set to the current running time of the game in milliseconds.

The seed value of the dice. The dice supplied in the FrameContext has the seed set to the current running time of the game in milliseconds.

Attributes

def shuffle[A](items: List[A]): List[A]

Shuffles a list of values into a random order

Shuffles a list of values into a random order

Attributes

Concrete methods

def rollBoolean: Boolean

Produces a random Boolean

Produces a random Boolean

Attributes

def shuffle[A](items: Batch[A]): Batch[A]
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any