XF 2.2 how to generate random number in a specific range in php

Codeless

Active member
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:
$min = 1.5;
$max = 3.5;
$randomNumber = $min + mt_rand() / mt_getrandmax() * ($max - $min);

i want to write in xenfor syntax
 
Back
Top Bottom