ScratchData LogoScratchData
Back to Kinderlabor's profile

Semicircles

KIKinderlabor•Created July 10, 2013
Semicircles
15
8
371 views
View on Scratch

Instructions

How does a computer generate random numbers? There are many ways, but the linear congruential method is a classic. Suppose you want to have a sequence of numbers between 0 and 8 that looks random. You choose a multiplier a, an offset b, and a seed value x0, all between 0 and 8. Then you set x to x0, and this is the first number in the "random" sequence. To get the next number, you replace x by (a*x+b) mod 9, and so on. That's it. Let's do an example: if x0=1, a=7, b=4, the sequence you get is 1, 2, 0, 4, 5, 3, 7, 8, 6,... After that, it continues with 1, and hence it repeats from this point on. In fact, every sequence repeats after at most 9 steps, but in practice, you would anyway replace 8 by some large number, and if you get the values of a,b and x0 right, the resulting sequence indeed appears to be pretty random. Here we have chosen 8, because then we can "draw" every number in the sequence as a semicircle (in one of 8 possible orientations), or as a hollow circle (that's what the 0 stands for). So what you see when you click on Scratch Cat is a drawing of the "random" sequence of the first 11 x 15 numbers that you get from the current slider values according to the above formula. Since the sequence repeats every at most 9 steps, we expect to get a pattern picture. But you already see that some values of a,b and x0 lead to patterns that look more random than others. Exactly the same is true for the real random number generators that are used in practice.

Description

This project builds on "Pattern Picture (Semicircles)", a 1957 work by the German Artist Charlotte Posenenske (1930-1985), see http://artbasel.insideguidance.com/miamibeach/2012/catalog/#!product/5dbf5466bb6d5d309ba89f3253063298 When I first saw the painting in an exhibition in Zurich, its mathematical flavor gave me the idea of including it in a Scratch project.

Project Details

Project ID11333491
CreatedJuly 10, 2013
Last ModifiedSeptember 5, 2013
SharedJuly 10, 2013
Visibilityvisible
CommentsAllowed