I am making an iPhone dice application and I wanted to create a button so that if I click it, it will generate a random number between 1 and 6 on the UITextField.
Can anyone help me out and give me a mathematical formula to generate such number?
Thanks
If you are using Objective-C, try:
The
6is needed becausearc4random() % nresults on a number from0ton-1.