Friday, November 6, 2015

PHP rand() exclude certain numbers

I have this:
<?php $n = rand(1,1600); echo $n ?>
I want to exclude from random numbers let's say 234, 1578 ,763 , 1274 and other numbers. How would I do that?
=========
<?php

while( in_array( ($n = rand(1,1600)), array(234, 1578 ,763 , 1274) ) );
shareimprove this answer