Saturday, September 6, 2008

Get a program to throw the dice for you...



Should anyone out there who cant sleep coz you're still looking for the solution to the last computing tutorial question -- write a program to simulate the outcome from the rolling of a six sided dice that runs 100 times -- this is my take on int. Hopes Google gets this post.

And should you be wondering why "1+rand()%6", %6 gives you the remainder of whatever random number the computer spits out. And there's a "1+" in front because there are random numbers that gives 0 as remainder.

Hope now you can get that good night sleep. Hmmm... guess now, there's something that i can teach at uni level. Tuition anyone?

No comments: