August '06 Installment: Von Neumann

“Von Neumann” is named in honor of mathematician and physicist John Von Neumann, whose “middle-square” pseudorandom number generator powers the engine used in this installment.

In computer programming, nothing is completely random, it’s all pseudorandom. That is, to create a “random” number, you feed a number into a formula and the result is your random number. Usually, computer functions such as Math.random() use the current date (including milliseconds) to feed to their random formula, and this is random enough. Yet technically, if you knew the formula, and the number fed to this formula (seed), you’d know the result.

In the case of this August installment, I wanted a random engine which I could feed a specific number, and it would always return the same random-looking number (if fed the same seed). I would use the pseudorandom product to scale, rotate, place and color various shapes in a space, creating pseudorandom artwork.

Middle-Square

Von Neumann came to the rescue with his middle-square method which is extremely easy to work with; quite simply, you square a 4 digit number, and choose the 4 middle digits of the end result.

11112 = 1234321 -> 3452

More elaborate PRNGs have been created, but the simplicity of this middle-square method, and the visual results were exactly fine for my purpose.

Result

The end result will replicate some pre-drawn shapes a specific number of times, then proceed to rotate them, scale them, animate them, position them and finally color them according to a color array I choose. All of this based on what random-seed the engine is fed. You can either enter this 4-digit random seed in the upper-left textbox, or you can drag the crosshair to use its coordinate to generate a seed for you.

In the next couple of months, I hope to elaborate this engine, add restraints, remove other restraints and generally see where it’ll take me. Art happens all the time.

View installment

15 thoughts on “August '06 Installment: Von Neumann”

  1. Chris says:

    5243 on configuration 5.

  2. Jonas Rabbe says:

    Very interesting concept. Can’t wait to see where you go with it.

  3. Joen says:

    Chris said:

    5243 on configuration 5.

    Yep, that one turned out pretty lucky! Thanks.

    Jonas Rabbe said:

    Very interesting concept. Can?t wait to see where you go with it.

    Me neither 🙂 and thanks.

  4. Nik says:

    Impressive stuff! I’m liking these more interactive installments, but I also miss the beautiful photography of the static installments..

  5. Sid says:

    Joen, this is really cool! Its like one of my projects for CS, but on steroids! Can’t wait for more.

  6. Joen says:

    Nik said:

    Impressive stuff! I?m liking these more interactive installments, but I also miss the beautiful photography of the static installments..

    Thanks Nik, I appreciate it. As for one versus the other… I think the static photography stuff can actually be combined with such an engine.

    Sid said:

    Joen, this is really cool! Its like one of my projects for CS, but on steroids! Can?t wait for more.

    Thanks. Do you have a link for your projec?

  7. Sid says:

    Joen, I’ll have to look and see, but from what I remember I used a K2 type generator to very randomly pick cards from a deck for some black jack. No where near as cool as yours ; ) but I made custom cards using Graphics2d, only the best of vector graphics for mua 😀

  8. Joen says:

    I had to look up “K2”, I kept thinking about the WordPress Theme

    K2:

    A sequence of numbers which is indistinguishable from ‘true random’ numbers according to specified statistical tests. The tests are the monobit test (equal numbers of ones and zeros in the sequence), poker test (a special instance of the chi-squared test), runs test (counts the frequency of runs of various lengths), longruns test (checks whether there exists any run of length 34 or greater in 20 000 bits of the sequence) — both from BSI2 (AIS 20, v. 1, 1999) and FIPS (140-1, 1994), and the autocorrelation test. In essence, these requirements are a test of how well a bit sequence: has zeros and ones equally often; after a sequence of n zeros (or ones), the next bit a one (or zero) with probablility one-half; and any selected subsequence contains no information about the next element(s) in the sequence.

    Is that correct? If so, very impressive, and certainly more random than the middle-square one.

  9. Sid says:

    Haha, I realised after I had comment that confusion would happen 😉 As for you question, yes sir, Thanks!

  10. Bilal says:

    Wow, very cool! 😮

  11. I like it. Also, looks very good as a background image.

  12. Joen says:

    Sebastian Schmieg said:

    I like it. Also, looks very good as a background image.

    Thanks. I should compile some of them into wallpapers, actually… not a bad idea.

  13. Anders Rask says:

    Extremely good! Your artistic talent keeps amazing me! Thumbs up!

  14. Joen says:

    Extremely good! Your artistic talent keeps amazing me! Thumbs up!

    Thanks a lot, I appreciate that.

Comments are closed.