swift - Round does not accept argument type(Int) -


i'm trying create app math test come division. know can't create repeating infinite decimals, , must keep numbers random. after generated numbers out of arc4random_uniform, i'm trying use round function. said

cannot find overload round accepts argument type (int)

how fix this?

here's code:

 var randomnumber:uint32 = arc4random_uniform(999)  var randomnumber2:uint32 = arc4random_uniform(999)  // 1000 maximum number now.  randomnumber += 1  randomnumber2 += 1  if operation.text == "/" {      if randomnumber < randomnumber2 {          var between:uint32 = 1000 - randomnumber2          randomnumber = randomnumber2 + arc4random_uniform(between - 1)          // making sure randomnumber not smaller randomnumber2,          // therefore results positive.      }      var answer:int = round(int(randomnumber)/int(randomnumber2))  } 

you have pass float value round since doesn't have prototypes using int value:

var answer = round(float(randomnumber)/float(randomnumber2)) 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -