libperun

Class std.gen.Generator

Synopsis

public abstract class Generator

An abstract generator. Generates a sequence based on some logic.

Fields

Constructors

Methods

public abstract float next();

Generate the next floating-point number, between 0 (inclusive) and 1 (exclusive).

public final int nextInt(int min,int max);

Generate an integer between min (inclusive) and max (exclusive).

public final int nextInt(int max);

Generate an integer between 0 (inclusive) and max (exclusive).

public final int nextInt();

Generate an integer between 0 (inclusive) and MAX_INT (exclusive).

public final bool probably(float chance);

Generates true with the specified chance, else false. The chance is between 0 and 1.

Arguments
chanceThe chance of returning true (between 0 and 1).
Returns

true with the specified chance, else false.