Random Archives

How to randomize, return and remove numbers from a pool

This morning in the IRC chat (irc.scriptschool.com #scriptschool) a random visitor named Rnd-Amarion stopped by with the following how-to PHP question:
I am about to learn PHP, and want to program a simple web page with a long string of random numbers. I have the random numbers allready. When someone queries the web site, it retrieves […]

Random web page background colors

If you want to create a random background color

<?php $hex = dechex(rand(0,255)) . dechex(rand(0,255)) . dechex(rand(0,255)); ?>

and then you’d use the following in your body tag:

<body BGCOLOR=“#<?php echo($hex);?>”>

Related
How to change background color only on holidays

How to not show the same thing twice when randomizing

Last night I was reviewing a new site that randomizes pages and I kept seeing the same pages coming up repeatedly. This is a rather common problem with many basic randomizers that do not keep track of what has already been shown.

This begs the question: how do you setup even distribution of a randomized […]