How can one ensure that the random numbers generated are truly random and not predictable?

To ensure that random numbers generated are truly random and not predictable, it is important to use a secure source of randomness, such as the random_int() function in PHP, which generates cryptographically secure random integers. Additionally, it is recommended to seed the random number generator with a truly random value, such as the current time in microseconds, to further enhance randomness.

// Seed the random number generator with a truly random value
mt_srand(random_int(PHP_INT_MIN, PHP_INT_MAX));

// Generate a cryptographically secure random integer
$randomNumber = random_int(1, 100);

echo $randomNumber;