Skip to content

Instantly share code, notes, and snippets.

@kashfifahim
Created January 24, 2018 06:51
Show Gist options
  • Save kashfifahim/b6a231a8427aab3969eb2baba11e9cfc to your computer and use it in GitHub Desktop.
Save kashfifahim/b6a231a8427aab3969eb2baba11e9cfc to your computer and use it in GitHub Desktop.
// our method is called startNewRound and it does not take any parameters
func startNewRound( ) {
targetValue = 1 + Int(arc4random_uniform(100))
// This generates a new random number between 1 and 100
currentValue = 50
slider.value = Float(currentValue)
// So when a new round starts, the slider and the currentValue
// are both reset to 50 or the middle of the slider
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment