\CryptoManana\Core\Interfaces\RandomnessArbitraryBaseOutputInterface

Interface ArbitraryBaseOutputInterface - Interface for arbitrary base number generation.

Summary

Methods
Constants
getBool()
getTernary()
getHex()
getBase64()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

getBool()

getBool() : boolean

Generate a random boolean.

Returns

boolean —

Randomly generated boolean value.

getTernary()

getTernary(boolean|integer  $asInteger = true) : boolean|integer

Generate a random ternary format (-1, 0, 1).

Note: Passing false to the $asInteger parameter will convert values to null, false and true.

Parameters

boolean|integer $asInteger

Flag for returning as integer (default => true).

Returns

boolean|integer —

Randomly generated ternary value.

getHex()

getHex(integer  $length = 1, boolean  $upperCase = false) : string

Generate a random HEX string.

Parameters

integer $length

The output string length (default => 1).

boolean $upperCase

Flag for using uppercase output (default => false).

Returns

string —

Randomly generated HEX string.

getBase64()

getBase64(integer  $length = 1, boolean  $urlFriendly = false) : string

Generate a random Base64 string.

Parameters

integer $length

The internal byte string length (default => 1).

boolean $urlFriendly

Flag for using URL friendly output (default => false).

Returns

string —

Randomly generated Base64 RFC 4648 standard string.