Documentation

DiceBag
in package

A collection of random number generators, with various distributions.

Table of Contents

chance()  : bool
Returns true $p percent of the time, where $p is between 0 and 1.
dice()  : int
Generates a uniformly randomly integer between $min and $max.
normal()  : float
Generates a normally distributed random number between $min and $max.
pseudoBell()  : int
This function has uniform distribution except for the extreme values, which are half as likely to happen.
uniform()  : float
Generates a uniformly randomly number between $min and $max.

Methods

chance()

Returns true $p percent of the time, where $p is between 0 and 1.

public chance(float $p) : bool
Parameters
$p : float
Return values
bool

True if you are lucky, False if not.

dice()

Generates a uniformly randomly integer between $min and $max.

public dice(int $min, int $max) : int
Parameters
$min : int
$max : int
Return values
int

random number between $min and $max

normal()

Generates a normally distributed random number between $min and $max.

public normal(float $min, float $max) : float
Parameters
$min : float
$max : float
Return values
float

normally distributed random number

pseudoBell()

This function has uniform distribution except for the extreme values, which are half as likely to happen.

public pseudoBell([int|null $min = null ][, int|null $max = null ]) : int

The code for this function was taken from LotGD in version 0.9.7.

Parameters
$min : int|null = null
$max : int|null = null
Tags
author

MightyE, JT

Return values
int

uniform()

Generates a uniformly randomly number between $min and $max.

public uniform(float $min, float $max) : float
Parameters
$min : float
$max : float
Return values
float

random number between $min and $max

Search results