Skip to content

This project was about writing a "real random generator" because most random generators in standard libraries are not really random.

License

Notifications You must be signed in to change notification settings

Cankar001/Facharbeit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scientific paper for school

In the 10th grade I did a coding project in school, the topic was writing a "real random generator" because most random generators in standard libraries are not really random. The idea was to throw a real cube on a desk, make a picture of the top side with a raspberry pi and analyze the picture to get the number of black dots on it. In theory the result should be really random, because it was generated by a human and not a machine.

The program loads the picture and gets the raw pixeldata, stores them in a two dimensional array which is as big as the multiplied width and the height of the picture. It also creates a bitmap of the same size, indicating if a pixel at a specified index is a black pixel or not. After that it runs a specific algorithm, I had two versions of this algorithm to analyze the picture, they are explained below.

V1

The first version was the more "naive" method, assuming that every black pixel circle is photographed symmetrical. This works fine, if you make the picture with a tripod or something similar from the top (but not great for handheld tries).

The algorithm tries to shrink every black circle from each side at the same time, until only one black pixel is left per circle. After that it runs through the bitmap and counts every black pixel, assuming that the count is the right count of black circles.

V2

This algorithm still tries to shrink the black circles, but it tries to do it recursively by taking the neighbour pixel count into account. Similar to GameOfLife, it checks the neighbour count and only removes the current pixel, if any neighbour is a black pixel. By that all black pixel of a circle are removed at once, leaving only one guaranteed black pixel per circle. The ending is the same, running through the bitmap and counting the black pixels.

The advantage of this algorithm is, that even unproportional pictures can be analyzed.

About

This project was about writing a "real random generator" because most random generators in standard libraries are not really random.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published