Bitrix API

RandomSequence

Class for generating pseudo random sequences.

Never use it for any security or cryptographic purposes.

use \Bitrix\Main\Type\RandomSequence; $rs = new RandomSequence("A"); echo $rs->randString();

Table of Contents

Methods

__construct()  : void
Starts new sequence of pseudo random values.
getNext()  : int
Returns next pseudo random value from the sequence.
rand()  : int
Returns next pseudo random number value from the sequence.
randString()  : string
Returns next pseudo random string value from the sequence.

Methods

__construct()

Starts new sequence of pseudo random values.

public __construct([string $seed = "" ]) : void
Parameters
$seed : string = ""

getNext()

Returns next pseudo random value from the sequence.

public getNext() : int

The result is signed 32 bit integer.

Return values
int

rand()

Returns next pseudo random number value from the sequence.

public rand(int $min, int $max) : int

between $min and $max including borders.

Parameters
$min : int
$max : int
Tags
throws
NotSupportedException
Return values
int

randString()

Returns next pseudo random string value from the sequence.

public randString([int $length = 10 ]) : string
Parameters
$length : int = 10
Return values
string

        
On this page

Search results