Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::IRandomNumberGenerator Class Referenceabstract

Interface for a random number generator. More...

#include <arcane/core/IRandomNumberGenerator.h>

Inheritance diagram for Arcane::IRandomNumberGenerator:
Collaboration diagram for Arcane::IRandomNumberGenerator:

Public Member Functions

virtual bool initSeed ()=0
 Method allowing initialization of the service.
virtual bool initSeed (ByteArrayView seed)=0
 Method allowing initialization of the service.
virtual ByteConstArrayView viewSeed ()=0
 Method allowing retrieval of a constant view of the current seed.
virtual ByteUniqueArray emptySeed ()=0
 Method allowing retrieval of an empty seed of the correct size.
virtual Integer neededSizeOfSeed ()=0
 Method allowing knowledge of the seed size required for the implementation.
virtual bool isLeapSeedSupported ()=0
 Method allowing knowledge if leaps are allowed on the seed generator.
virtual ByteUniqueArray generateRandomSeed (Integer leap=0)=0
 Method allowing generation of a "child" seed from a "parent" seed.
virtual ByteUniqueArray generateRandomSeed (ByteArrayView parent_seed, Integer leap=0)=0
 Method allowing generation of a "child" seed from a "parent" seed.
virtual bool isLeapNumberSupported ()=0
 Method allowing knowledge if leaps are allowed on the number generator.
virtual Real generateRandomNumber (Integer leap=0)=0
 Method allowing generation of a random number using the seed in memory.
virtual Real generateRandomNumber (ByteArrayView seed, Integer leap=0)=0
 Method allowing generation of a random number using the seed passed as a parameter.

Detailed Description

Interface for a random number generator.

Definition at line 202 of file IRandomNumberGenerator.h.

Member Function Documentation

◆ emptySeed()

virtual ByteUniqueArray Arcane::IRandomNumberGenerator::emptySeed ( )
pure virtual

Method allowing retrieval of an empty seed of the correct size.

Returns
ByteUniqueArray The empty seed.

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ generateRandomNumber() [1/2]

virtual Real Arcane::IRandomNumberGenerator::generateRandomNumber ( ByteArrayView seed,
Integer leap = 0 )
pure virtual

Method allowing generation of a random number using the seed passed as a parameter.

This method does not use the seed in memory but the seed provided as a parameter. If the seed provided as a parameter does not have the correct size, an error will be raised.

Parameters
seedThe seed.
leapThe leap to perform (0 = number n+1+0 / 1 = number n+1+1).
Returns
Real The generated number (between 0 and 1).

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ generateRandomNumber() [2/2]

virtual Real Arcane::IRandomNumberGenerator::generateRandomNumber ( Integer leap = 0)
pure virtual

Method allowing generation of a random number using the seed in memory.

Parameters
leapThe leap to perform (0 = number n+1+0 / 1 = number n+1+1).
Returns
Real The generated number (between 0 and 1).

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ generateRandomSeed() [1/2]

virtual ByteUniqueArray Arcane::IRandomNumberGenerator::generateRandomSeed ( ByteArrayView parent_seed,
Integer leap = 0 )
pure virtual

Method allowing generation of a "child" seed from a "parent" seed.

This method does not use the seed in memory but the seed provided as a parameter. If the seed provided as a parameter does not have the correct size, an error will be raised.

Parameters
parent_seedThe "parent" seed.
leapThe leap to perform (0 = seed n+1+0 / 1 = seed n+1+1).
Returns
ByteUniqueArray The new seed generated from the "parent" seed.

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ generateRandomSeed() [2/2]

virtual ByteUniqueArray Arcane::IRandomNumberGenerator::generateRandomSeed ( Integer leap = 0)
pure virtual

Method allowing generation of a "child" seed from a "parent" seed.

Parameters
leapThe leap to perform (0 = seed n+1+0 / 1 = seed n+1+1).
Returns
ByteUniqueArray The new seed generated from the seed in memory.

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ initSeed() [1/2]

virtual bool Arcane::IRandomNumberGenerator::initSeed ( )
pure virtual

Method allowing initialization of the service.

With the seed optional (or the default seed if in singleton mode).

Returns
true If initialization was successful.
false If initialization did not occur.

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ initSeed() [2/2]

virtual bool Arcane::IRandomNumberGenerator::initSeed ( ByteArrayView seed)
pure virtual

Method allowing initialization of the service.

If the seed does not have the correct size, false will be returned.

Parameters
seedThe original seed.
Returns
true If initialization was successful.
false If initialization did not occur.

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ isLeapNumberSupported()

virtual bool Arcane::IRandomNumberGenerator::isLeapNumberSupported ( )
pure virtual

Method allowing knowledge if leaps are allowed on the number generator.

Returns
true If yes.
false If no.

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ isLeapSeedSupported()

virtual bool Arcane::IRandomNumberGenerator::isLeapSeedSupported ( )
pure virtual

Method allowing knowledge if leaps are allowed on the seed generator.

Returns
true If yes.
false If no.

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ neededSizeOfSeed()

virtual Integer Arcane::IRandomNumberGenerator::neededSizeOfSeed ( )
pure virtual

Method allowing knowledge of the seed size required for the implementation.

Returns
Integer The required seed size (in bytes).

Implemented in Arcane::PDESRandomNumberGeneratorService.

◆ viewSeed()

virtual ByteConstArrayView Arcane::IRandomNumberGenerator::viewSeed ( )
pure virtual

Method allowing retrieval of a constant view of the current seed.

Returns
ByteArrayView The seed.

Implemented in Arcane::PDESRandomNumberGeneratorService.


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