src/pmc/random.pmc - Random Numbers


These are the vtable functions for the Random base class.

This is a singleton (monadic) class - only one instance exists.

Methods ^

void class_init()

Class initialization. Clears the singleton PMC.

void *get_pointer()

void set_pointer(void *ptr)

These two functions are part of the singleton creation interface. For more information see src/pmc.c.

void set_integer_native(INTVAL seed)

Sets the random number seed to seed.

INTVAL get_integer()

Returns a random integer in the range -2^31..2^31.

INTVAL get_integer_keyed_int(INTVAL max)

Returns a random integer in the range 0..max.

FLOATVAL get_number()

Returns a random floating-point number in the range 0.0..1.0.


2003.12.10 first rev by leo.