Quiz 3: 2.2, Question 8 incorrect answer, again?

I was taking the 2.2 quiz tonight and ran into a similar issue to the one mentioned in this discussion: Quiz 3: 2.2, Question 8 incorrect answer?

Question 8:
Which statement would successfully generate random numbers from the set: 1, 2, 3, 4, 5 ?

Well, similar but opposite. I understood that the min was inclusive and max was exclusive, so I selected Random.Range(1,6); And it was wrong.

Once I chose Random.Range(1,5); it said it was correct.

It’s Random.Range(1,6); Right?

It depends on the type of the values being passed to the method. As per the documentation if you pass floats in then the max is inclusive but if you pass an integers in then it’s exclusive of max.

It doesn’t appear to specify it so yeah I would expect 1,6 to be correct since you’re looking for 5 as your max and the options are all non floats.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms