Unique Random Numbers in PHP

If you would like to show random numbers using PHP you can do this:

<?php
        $min = 1;
        $max = 100;
        $total = 100;
        $arrItems = array();
        while ( count($arrItems) < $total ) {
                $item = mt_rand($min,$max);
                if (!in_array($item,$arrItems)) {
                        $arrItems[] = $item;
                        echo $item."<br/>";
                }
        }
?>

Share This Article

Related Posts

Comments

There are no comments on this entry.

Trackbacks

There are no trackbacks on this entry.

Add a Comment

Required

Required

Optional

Latest Domains

1. teledyne.com
(6 hours ago)
2. ngtechonology.com
(6 hours ago)
3. nonude.in
(7 hours ago)
4. spicyhunt.com
(13 hours ago)
5. whpromotions.co.uk
(16 hours ago)
6. seslihome.com
(17 hours ago)
7. sesliislam.com
(20 hours ago)
8. woopra.com
(1 day ago)
9. wapdam.com
(1 day ago)
10. 193.105.134.194
(1 day ago)

Services

PHP MySQL Apache Flash Air Java C++ Python