Last active
May 14, 2017 14:35
-
-
Save compermisos/3e622d0f5103e71f24690c4fee9c681d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
// Code FROM http://stackoverflow.com/questions/14079703/str-shuffle-and-randomness | |
header("Content-type: image/png"); | |
$im = @imagecreatetruecolor(512, 512) or die("Cannot Initialize new GD image stream"); | |
$white = imagecolorallocate($im, 255, 255, 255); | |
for($y = 0; $y < 512; $y ++) { | |
for($x = 0; $x < 512; $x ++) { | |
if (testMTRand()) { //change each function here | |
imagesetpixel($im, $x, $y, $white); | |
} | |
} | |
} | |
imagepng($im); | |
imagedestroy($im); | |
function testMTRand() { | |
return mt_rand(0, 1); | |
} | |
function testRand() { | |
return rand(0, 1); | |
} | |
function testShuffle() { | |
return substr(str_shuffle("01"), 0, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment