\CryptoManana\UtilitiesDataShuffler

Class DataShuffler - Utility class for data shuffling.

Summary

Methods
Properties
Constants
__construct()
__destruct()
__clone()
seedRandomGenerator()
setRandomGenerator()
getRandomGenerator()
shuffleString()
shuffleArray()
$randomnessSource
No constants found
No protected methods found
$randomnessSource
N/A
No private methods found
No private properties found
N/A

Properties

$randomnessSource

$randomnessSource : \CryptoManana\Core\Abstractions\Randomness\AbstractGenerator

The pseudo-random generator service property storage.

The randomness generator.

Type

\CryptoManana\Core\Abstractions\Randomness\AbstractGenerator — The pseudo-random generator service.

Methods

__construct()

__construct(\CryptoManana\Core\Abstractions\Randomness\AbstractGenerator|null  $generator = null) 

Container constructor.

Parameters

\CryptoManana\Core\Abstractions\Randomness\AbstractGenerator|null $generator

The pseudo-random generator service.

Throws

\Exception

Initialization validation.

__destruct()

__destruct() 

Container destructor.

__clone()

__clone() 

Container cloning via deep copy.

seedRandomGenerator()

seedRandomGenerator(null|integer  $seed = null) : $this

Pass a seed value to the pseudo-randomness generator service.

Parameters

null|integer $seed

Seed value in integer format or null for auto-seeding.

Throws

\Exception

Validation errors and service misuse.

Returns

$this —

The container object.

setRandomGenerator()

setRandomGenerator(\CryptoManana\Core\Abstractions\Randomness\AbstractGenerator  $generator) : $this

Setter for the pseudo-random generator service.

Parameters

\CryptoManana\Core\Abstractions\Randomness\AbstractGenerator $generator

The pseudo-random generator service.

Returns

$this —

The container object.

shuffleString()

shuffleString(string  $string = '') : string

Shuffle a string.

Parameters

string $string

The string for shuffling.

Throws

\Exception

Validation errors.

Returns

string —

The output shuffled/scrambled string.

shuffleArray()

shuffleArray(array  $array = array()) : array

Shuffle an array.

Parameters

array $array

The array for shuffling.

Returns

array —

The output shuffled/scrambled array.