Randomizing numbers
There can be a number of reasons you will want your mobile app to generate random numbers. You might create a slot or another gambling app or simply want enemy robots in a game to come from random vectors. Regardless of your need, LiveCode makes it easy to generate random numbers.
How to do it...
In this recipe, you will create a user interface that allows the user to enter upper and lower limits and then generate a random number within those limits.
- Open LiveCode and create a new main stack.
- Drag a new label field to the card and set the following properties:
- Name:
fld_Lower
- foregroundColor: Yellow
- Width:
158
- Height:
32
- Location:
87
,64
- Font: Courier
- Text size: 18
- Text style: Bold
- Align text center
- Contents:
Set Lower Limit:
- Name:
- Drag a second label field to the card and set the following properties:
- Name:
fld_Upper
- foregroundColor: Yellow
- Width:
158
- Height:
32
- Location:
259
,64
- Font: Courier
- Text size: 18
- Text style: Bold
- Align text center
- Contents:
Set Upper Limit:
- Name:
- Drag a new text entry field to...