Generate a random number

 Problem

I want to generate a random number, between 0 and N-1.



 Recipe


// Generate a random number
// between 0 and 9 (10-1)

let rand = Int(arc4random_uniform(10))

print(rand)
				


 Playground

Programming Tip : Migrate your programming/testing environment into the cloud by loading your essential programming tools on high performance citrix vdi from CloudDesktopOnline with remote accessibility from anywhere on any device(PC/android/iOS). To learn more about innovate cloud apps such as Hosted SharePoint, Exchange and managed azure services visit Apps4Rent.


Find answers here

Hi there! Ask Us a Question We are ready to help