'Brand new to coding - added a button how to add random number

Im brand new to learning coding and I have just started teaching myself swift this week. I've made a button on my screen and want it to display a random number between 1-100 when pressed. Can anyone assist? Thanks



Solution 1:[1]

You can get a random Int between 1 and 100 by

Int.random(in: 1..<101)

But please add more info to your question

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Suyash Medhavi