46
14
I've always liked screens full of randomly colored pixels. They're interesting to look at and the programs that draw them are fun to watch.
The challenge
Fill your screen, or a graphical window, with colored pixels.
The rules
- Your program must have an even chance of picking all colors (i.e in the range
#000000
to#FFFFFF
), or all colors that can be displayed on your system. - Your program must continue to display random pixels until manually stopped (it cannot terminate on its own).
- Pixels can be any size, as long as your output has at least 40x40 "pixels".
- Your program must run at such a speed that it can replace every pixel on the screen/window at least once after running for three minutes.
- Your program must choose truly random colors and points to replace, i.e. random with all points/colors equally likely. It cannot just look random. It must use a pRNG or better, and the output cannot be the same every time.
- Your program must have an equal chance of picking all colors each iteration.
- Your program must replace only one pixel at once.
- Your program cannot use the internet nor your filesystem (
/dev/random
and/dev/urandom
excepted).
Example
Your output could look like this if stopped at a random time:
The winner
The shortest answer in each language wins. Have fun!
By "truly random", I assume pseudorandom is OK (like Math.random() or similar) – OldBunny2800 – 2017-06-02T01:29:57.340
@OldBunny2800
It must use a pRNG or better
– TheLethalCoder – 2017-06-02T13:07:36.310Since the program can't use the internet, I'll just leave this in a comment: https://babelia.libraryofbabel.info/slideshow.html
– KSmarts – 2017-06-02T13:28:57.2671So does the "3 minute limit" apply to setup time, too? Or just once the "program" begins? Asking because I have a Minecraft redstone solution, which runs very quickly once it is going, but takes a while to set up initially (it has to "place" each "pixel" in the 40x40 grid) before it can start changing colors. – BradC – 2017-06-04T02:34:18.320
5Truly random by definition exclude pseudo-random, yet doesn't define a distribution. I assume you mean a uniform PRNG, where all events are equiprobable and independent of each other. – Dennis – 2017-06-04T04:44:18.230
What if I the display of my system is too small for 40x40? – SIGSTACKFAULT – 2017-10-17T02:03:09.860
Related: Random Pixel Poking
– sergiol – 2017-10-29T22:21:05.717Geometry Dash Leaked 2.2 Editor - 16778817 objects (theoretically). Sadly, this does not meet the 3 minute requirement because it would crash a supercomputer and is also not possible to store in your computer (look at the object count) :( – MilkyWay90 – 2019-03-02T03:25:05.807