Byt Wiki

Random Functions Documentation

This file contains a collection of functions for generating random values.

1. randomString

Description: Generate a random string.

Parameters:

Returns:

Usage:

$randomStr = randomString(8);
echo $randomStr; // Example: aB3dE9Gh

2. randomInt

Description: Generate a random integer within a range.

Parameters:

Returns:

Usage:

$randomInt = randomInt(1, 10);
echo $randomInt; // Example: 7

3. generatePassword

Description: Generate a random password.

Parameters:

Returns:

Usage:

$password = generatePassword(12);
echo $password; // Example: 1a2B3c4D5e6F

Example Usage

// Generating a random string
echo randomString(8); // Example output: aB3dE9Gh

// Generating a random integer between 1 and 10
echo randomInt(1, 10); // Example output: 7

// Generating a random password of length 12
echo generatePassword(12); // Example output: 1a2B3c4D5e6F