I need to produce 3 random numbers (from 2 to 5) that aren't the same. The first and second variables are what they are, and the third variable shouldn't equal either one of the first two. I have this code (which doesn't work for me, obviously), and I have tried multiple variations of operators. I can figure out how to do this with a large amount of IF loops, but I really don't want to..
I am at a loss and would appreciate some help.
Code: Select all
$dAlbumA = rand(2, 3);
$dAlbumB = rand(4, 5);
$dAlbumC = rand(2, 5);
} while (($dAlbumC != $dAlbumA) && ($dAlbumC != $dAlbumB));
echo $dAlbumA . " " . $dAlbumB . " " . $dAlbumC;