Random
in package
uses
ArrayEnabled
Table of Contents
Properties
Methods
- rand() : float|int
- RAND.
- randArray() : array<string|int, mixed>|string
- RANDARRAY.
- randBetween() : array<string|int, mixed>|int|string
- RANDBETWEEN.
- evaluateArrayArguments() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
- evaluateArrayArgumentsIgnore() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
- evaluateArrayArgumentsSubset() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
- evaluateArrayArgumentsSubsetFrom() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
- evaluateSingleArgumentArray() : array<string|int, mixed>
- Handles array argument processing when the function accepts a single argument that can be an array argument.
- initialiseHelper() : void
- testFalse() : bool
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
rand()
RAND.
public
static rand() : float|int
Return values
float|int —Random number
randArray()
RANDARRAY.
public
static randArray([mixed $rows = 1 ][, mixed $columns = 1 ][, mixed $min = 0 ][, mixed $max = 1 ][, bool $wholeNumber = false ]) : array<string|int, mixed>|string
Generates a list of sequential numbers in an array.
Excel Function: RANDARRAY([rows],[columns],[start],[step])
Parameters
- $rows : mixed = 1
-
the number of rows to return, defaults to 1
- $columns : mixed = 1
-
the number of columns to return, defaults to 1
- $min : mixed = 0
-
the minimum number to be returned, defaults to 0
- $max : mixed = 1
-
the maximum number to be returned, defaults to 1
- $wholeNumber : bool = false
-
the type of numbers to return: False - Decimal numbers to 15 decimal places. (default) True - Whole (integer) numbers
Return values
array<string|int, mixed>|string —The resulting array, or a string containing an error
randBetween()
RANDBETWEEN.
public
static randBetween(mixed $min, mixed $max) : array<string|int, mixed>|int|string
Parameters
- $min : mixed
-
Minimal value Or can be an array of values
- $max : mixed
-
Maximal value Or can be an array of values
Return values
array<string|int, mixed>|int|string —Random number If an array of numbers is passed as an argument, then the returned result will also be an array with the same dimensions
evaluateArrayArguments()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
protected
static evaluateArrayArguments(callable $method, mixed ...$arguments) : array<string|int, mixed>
Example use for: ROUND() or DATE().
Parameters
- $method : callable
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsIgnore()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
protected
static evaluateArrayArgumentsIgnore(callable $method, int $ignore, mixed ...$arguments) : array<string|int, mixed>
Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.
Parameters
- $method : callable
- $ignore : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubset()
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
protected
static evaluateArrayArgumentsSubset(callable $method, int $limit, mixed ...$arguments) : array<string|int, mixed>
Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.
Parameters
- $method : callable
- $limit : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubsetFrom()
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
protected
static evaluateArrayArgumentsSubsetFrom(callable $method, int $start, mixed ...$arguments) : array<string|int, mixed>
Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.
Parameters
- $method : callable
- $start : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateSingleArgumentArray()
Handles array argument processing when the function accepts a single argument that can be an array argument.
protected
static evaluateSingleArgumentArray(callable $method, array<string|int, mixed> $values) : array<string|int, mixed>
Example use for: DAYOFMONTH() or FACT().
Parameters
- $method : callable
- $values : array<string|int, mixed>
Return values
array<string|int, mixed>initialiseHelper()
private
static initialiseHelper(array<string|int, mixed>|false $arguments) : void
Parameters
- $arguments : array<string|int, mixed>|false
-
Can be changed to array for Php8.1+
testFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed