
|
The following example application uses a simple random number generation algorithm in order to show dice with random values on the screen. The dice are displayed both in the application space and in the application menu bar. Download example application>> The screen shot below shows the running application:
The application can be useful when playing games that require one or more dice. Random numbers can be generated using Math::Rand(). Another method for generating pseudo-random numbers is to use a mixed congruential generator as follows: x(n+1) = (a*x(n)+b)) (mod m) Here, a, b and m are constants which should be carefully chosen since only certain values will give good random numbers. From each value x(n), the next value in the sequence, x(n+1) can be computed. The following table shows some specific congruential generators:
The dice example application uses the Wichmann-Hill congruential generator. In order to draw small dice in the menu bar, controls are added using the MQikViewContext interface: The application icon that is shown in the upper left corner is changed using the following API: CQikViewBase::SetAppTitleIconL(); To build the example application for UIQ 3-based phones, use the following commands:$ bldmake bldfiles More information: | |||||||||||||||||||||||||
Copyright © 2001 - 2009 Sony Ericsson Mobile Communications AB. All Rights Reserved.