samedi 28 mars 2020

How to exclude random number from another random number in php

I have a random number. 1 or 2 for sake of testing.

$rn = chr(49+rand(0,1)) ;

I want to then exclude that $rn from another $rn2. So if the first $rn is 2, I want the second $rn2 to be 1.

I've tried things like,

$rn2 = chr(49+rand(0,1)) ;  
$rn2 != $rn ;

and

$rn2 = chr(49+rand(0,1, !$rn));



Aucun commentaire:

Enregistrer un commentaire