PHP Class Vimeo\ABLincoln\Operators\RandomOperator

Required Inputs: None Optional Inputs: - 'salt': salt for hash (should generally be unique for each random variable). If 'salt' input not specified, parameter name is used as random variable salt.
Inheritance: extends AbstractSimpleOperator
Datei anzeigen Open project: vimeo/ablincoln

Public Methods

Method Description
__construct ( array $options, mixed $inputs ) Constructor: store given parameters and establish scale for hashing

Protected Methods

Method Description
_getHash ( mixed $appended_unit = null ) : integer Form a complete salt string and hash it to a number
_getUniform ( $min_val, $max_val = 1, $appended_unit = null ) : float Get a random decimal between two provided values

Private Methods

Method Description
_getUnit ( mixed $appended_unit = null ) : array Format all units into an array before hashing

Method Details

__construct() public method

Constructor: store given parameters and establish scale for hashing
public __construct ( array $options, mixed $inputs )
$options array array mapping operator options to values
$inputs mixed input value/array used for hashing

_getHash() protected method

Form a complete salt string and hash it to a number
protected _getHash ( mixed $appended_unit = null ) : integer
$appended_unit mixed optional extra unit used for hashing
return integer decimal representation of computed SHA1 hash

_getUniform() protected method

Get a random decimal between two provided values
protected _getUniform ( $min_val, $max_val = 1, $appended_unit = null ) : float
return float random number between the two provided values