PDA

View Full Version : Random number 1-6


Powerhouse64
11-06-2011, 06:30 PM
So, for a programming class, we had an assignment to make a dice simulator. Everyone in the class but me tried using the random number generator, and testing which numbers were closest to 1-6. Rather than be a sheep, I decided to try it in a different way, and this is the result! I am pretty proud of the program, and it works reliably (though the numbers aren't perfectly spaced, they are close enough for each number to have essentially equal chances of being selected). Feel free to try it out, and let me know if you have any improvements. The assignment is long gone, but I'm too much of a perfectionist to leave this program alone, I'd love some suggestions on how to improve its accuracy, or any other aspect!

EDIT: You do have to restart every time you want the program to come up with a new value.

Mr Kidnapper
11-06-2011, 06:37 PM
Mr. Kidnapper doesn't understand how this is a different way.

Powerhouse64
11-06-2011, 06:45 PM
Other kids used random number generators to select a value, then had Alice print out the closest whole number, mine randomly spins an object, then decides which number it is nearest to. Mine has a visual aspect to it that works without having to deal with the silly an infuriating decimal point. It has the same purpose, but it's done in a different (and I would hope, more creative) way.

Mr Kidnapper
11-06-2011, 06:52 PM
By the way, people in this forum have a tendency to place objects by hand, and it always looks very messy. To avoid this, you have to place objects mechanically. Use the alice click menus and move objects with numbers instead. If you get good at this, it's usually faster than doing it by hand.

Powerhouse64
11-06-2011, 07:28 PM
Well, I used a 12-sided object and placed the center of the number's axis on every other corner. It got the spacing pretty accurate, I think. But since I made this program, I figured out how to place objects by using their coordinates, and I could tidy this program up with that now that you mention it! Thanks!:D