RSS Feed/News how to generate random number in a specific range in php

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
24,664
Points
823

Reputation:

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...
 
Status
Not open for further replies.
Top