0
Random number/dice role generator
I'm very (very) new to this but I used another app to make a random dice roll generator - where each number linked to a different picture. Each picture denoted something to do in a day off. How easy would it be to recreate that from basics?
1 Antwort
+ 4
You could search how to get random numbers in Playgrounds.
Here's an example you'd do:
int random = Random.nextInt();
int diceRoll = (random % 6) +1; //Because a dice has 6 sides.
Then you can use diceRoll to act as a dice that had been rolled.
Here's a few examples:
https://code.sololearn.com/cbruTEsBYLtv/?ref=app
https://code.sololearn.com/c4uqgMbOS09o/?ref=app
https://code.sololearn.com/c7YPsJNZJk8b/?ref=app
https://code.sololearn.com/coIPiAnFxnoq/?ref=app
https://code.sololearn.com/czWiR5oHtz83/?ref=app
https://code.sololearn.com/w15ymgODle4h/?ref=app
https://code.sololearn.com/WSgfsRgTJU69/?ref=app