how to generate random number in a specific range in php

Status
This content is read-only, or is not open for further replies.

Codeless

Guest
offline
Hi how to generate random number in a specific range in php for example

PHP:

$randomNumber = rand(200, 500);
generating random number while keeping in range of 200 to 500
PHP:

Code:
$min = 1.5;
$max = 3.5;
$randomNumber = $min + mt_rand() / mt_getrandmax() * ($max - $min);

i want to write in xenfor syntax

Continue reading...
 
Liked by:
Status
This content is read-only, or is not open for further replies.
Top Bottom