AIToolbox
A library that offers tools for AI problem solving.
AIToolbox::Seeder Class Reference

This class is an internal class used to seed all random engines in the library. More...

#include <AIToolbox/Seeder.hpp>

Static Public Member Functions

static unsigned getSeed ()
 This function gets a random number to seed generators. More...
 
static void setRootSeed (unsigned seed)
 This function sets the seed for the seed generator. More...
 
static unsigned getRootSeed ()
 This function returns the root seed of Seeder. More...
 

Detailed Description

This class is an internal class used to seed all random engines in the library.

To avoid seeding all generators with a single seed equal to the current time, only this class is setup with the time seed, while all others are seeded with numbers generated from this class to obtain maximum randomness.

Member Function Documentation

◆ getRootSeed()

static unsigned AIToolbox::Seeder::getRootSeed ( )
static

This function returns the root seed of Seeder.

This works even if it has not been set manually. In this way it is possible to log the original seed of a run to replicate it.

Returns
The last set root seed.

◆ getSeed()

static unsigned AIToolbox::Seeder::getSeed ( )
static

This function gets a random number to seed generators.

Returns
A random unsigned number.

◆ setRootSeed()

static void AIToolbox::Seeder::setRootSeed ( unsigned  seed)
static

This function sets the seed for the seed generator.

By default the generator is seeded with the current time. If this is not satisfactory, due for example to the need of having reproducible experiments, this function can be called in order to seed the underlying generator.

Parameters
seedThe seed for the underlying generator.

The documentation for this class was generated from the following file: