O'Reilly logo

DarkBASIC Pro Game Programming, Second Edition by Joshua R. Smith, Jonathan S. Harbour

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Random Numbers

You often need a random number to mix up something, such as a virtual deck of cards or pair of dice. Random numbers are frequently used in games to keep the game play interesting from one scene to the next. Randomness also comes into play when you are dealing with data encryption and compression, as well as in simulation programs (such as business and financial simulations). For example, suppose you want to move an enemy ship around the screen to attack a player. It will be more of a challenge if the enemy ship moves from place to place in an unpredictable manner instead of a predetermined manner; random numbers can help you accomplish that.

Creating Random Numbers

DarkBASIC provides an easy-to-use random number generator called ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required