Answer the question
In order to leave comments, you need to log in
How to remove artifacts in the random number generator (rand function)?
I am creating a 512x high resolution texture pack for Minecraft. Images must consist of randomly placed pixels of two colors. To do this, I use a browser in which I create an image from one-pixel divs grouped via float:left.
<?php
echo '<style>
#q{background:#FFF}
#w{background:#000}
#q,#w{float:left;width:1px;height:1px}
</style>';
echo '<div style="width:128px;height:128px">';
for($i=0;$i<(128*128);$i++){
if(0==rand(0,1)){
echo '<div id="q"></div>';
}else{
echo '<div id="w"></div>';
}
}
echo '</div>';
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question