Generating Cryptographically Secure Random Numbers in PHP


Generate secure random integers with random_int().

Source Code

try {
    echo random_int(1, 10); // Outputs a random number between 1 and 10
} catch (Exception $e) {
    echo "Could not generate a random integer.";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments