Interface to the OS number rg.

`

Older versios of YAP supported random number access through the expression X is random. Inspired by SWI-Prolog, the newer code supports:

  • initialization;

  • random numbers as integers (signed or absolute) or as floating points;

  • cryptographic quality random numbers

By default YAP uses random, the pseudo-random number generator. Use the prolog flag random_number_generator if you prefer random or rand. Use arc4random for higher quality random numbers, that do not have a seed.

Functions:

1. double Yap_random(void):

1. UInt Yap_unsigned_integer_random(void):

1. Int Yap_signed_integer_random(void):

1. static Int Yap_integer_in_range(uint64_t min, uint64_t max):

1. static Int Yap_double_in_range(double min, double max):

1. static Int Srandom(USES_REGS1): : "srandom(Seed" )

@class srandom_1

Set the Seed for the pseudo random generator.

1. static Int URandom(USES_REGS1): : "random(-Positive_Integer" )

@class random_1

Unify the first argument with an unsigned pseudo-random integer.

1. static Int rando/3(USES_REGS1): : "random(+Min,+Max,-R" )

@class random_3

Unify the third argument with an pseudo-random number in the interval [Min-Max[. If both Min and Max are integers, R will also be an integer, otherwise _R will be a floating point number.

1. static Int Random(USES_REGS1): : "signed_random(-Integer" )

@class signed_random_1

Unify the first argument with an pseudo-random integer.

1. void Yap_InitRandom(void): : Initialize the default random number generator.

uses the process's srand call.

1. void Yap_InitRandomPreds(void):