Download the PHP package gamebetr/provable without Composer
On this page you can find all versions of the php package gamebetr/provable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gamebetr/provable
More information about gamebetr/provable
Files in gamebetr/provable
Package provable
Short Description Package that provides the ability to create provably fair numbers and shuffles
License
Informations about the package provable
Provable
This package provides the means to create provibly fair random numbers and provably fair random shuffles.
Installation
via composer:
Basic Useage
Methods
__construct(string $clientSeed = null, string $serverSeed = null, int $min = 0, int $max = 0, string $type = 'number')
The class constructor takes the optional parameters, clientSeed, serverSeed, min, max, and type. If clientSeed or serverSeed are not provided, it will generate random seeds automatically. The min and max parameters are the minimum and maximum values of the random number or shuffle. Type is either number
or shuffle
.
static init(string $clientSeed = null, string $serverSeed = null, int $min = 0, int $max = 0, string $type = 'number')
The init method is just a static constructor. It allows you to do the following:
setClientSeed(string $clientSeed = null)
This sets the client seed. If no seed is provided, one will be automatically generated. The Provable instance is returned allowing you to chain commands.
getClientSeed()
This returns the current client seed.
setServerSeed(string $serverSeed = null)
This sets the server seed. If no seed is provided, one will be automatically generated. The Provable instance is returned allowing you to chain commands.
getServerSeed()
This returns the current server seed.
getHashedServerSeed()
This returns the hashed version of the server seed.
setMin(int $min)
This sets the minimum value property. The Provable instance is returned allowing you to chain commands.
getMin()
This returns the current minimum value property.
setMax(int $max)
This sets the maximum value property. The Provable instance is returned allowing you to chain commands.
getMax()
This returns the current maximum value property.
setType(string $type)
This sets the type property. Allowed values are number and shuffle. The Provable instance is returned allowing you to chain commands.
getType()
This returns the current type property.
results()
This calculates the random number or shuffle and returns it.
number(int $minimumNumber = null, int $maximumNumber = null)
This generates a random number between $minimumNumber and $maximumNumber. If no values are provided, it will use the $min and $max properties of the object.
shuffle(int $minimumNumber = null, int $maximumNumber = null)
This generates a random shuffle of numbers between $minimumNumber and $maximumNumber. If no values are provided, it will use the $min and $max properties of the object.