Wednesday, September 07, 2016

Of Dice and Men

In a college  I first learned about Stochastic analysis and Monti Carlo Simulations. Whoa! An academic sounding reason to play with random numbers. It was only later that I discovered randomness as applied to cryptography. By then I had long before  been fascinated by random numbers (or at least pseudo random numbers) in computer programs. I still love using them today. They just make programming more interesting.

In my college work in System Analysis (one of my two majors) we used random numbers as part of building simulations. I enjoyed doing them. I keep thinking I should come up with some simple simulations to have my students work though. Perhaps the old ski lift simulation. If I could remember the details. Maybe I am getting old.

Of course games are a regular use for random numbers in student projects. One of the classes I have students create with we talk about programming classes is a Die class. Binary DiceTo make it interesting I have to help them think beyond the normal six sided die with six values. I talk about two sided dice or as they soon realize – coins. And of course many sided dice such as those used in role playing games.

A while back my wife got me a set of Binary dice. Six sides but only two values – one or zero of course. The visual seems to help stimulate out of the box in thinking.

If I were teaching AP CS A and/or teaching inheritance the die class might be a fun one to use. Create a coin class or perhaps a dial class from the die class? I need to think about that more. Anyone reading doing something like that they could share?

Of course random numbers have other uses. I have a 20,000 entry database of names and birthdays that I created by randomly picking first and last names from lists I got at the Bureau of the Census (for example Frequently Occurring Surnames from the Census 2000) and then randomly making up months, days and years using random numbers,. That was actually fun to write. Having a dataset that large makes it obvious to students why a computerized system makes sense.

I’m not sure that my students catch my love of such programming projects. Or rather the fact of pseudo random numbers making them work in interesting ways. I do hope that it makes for projects that interest them though.You never know were something will lead. Randomness is everywhere.

No comments: