Conversation
|
|
||
| - Java does not provide a function to choose an element from a collection at random. | ||
| - Remember that you can retrieve an element from an array by its index, which is an integer. | ||
| - The `java.util.Random` class provides a method to generate a random `int` between 0 and a given maximum. |
There was a problem hiding this comment.
Doesn't this have the same inclusivity / exclusivity problem? The hint for Generate a random stardate might also have this problem.
What do you think about using a general hint for the inclusivity / exclusivity instead? A general hint would be placed before the hints for the first task (see the hints for Annalyn's infiltration for an example).
| - The `java.util.Random` class provides an overloaded method (a variation on another method) to generate a random `int` between given minimum (inclusive) and a given maximum (exclusive). | ||
|
|
||
| ## 3. Generate a random stardate | ||
|
|
There was a problem hiding this comment.
I noticed the very last hint (on line 15) seems to be missing a couple of words between class and method (sorry, for some reason Github isn't letting me put this comment on the last line). It currently says:
The
java.util.Randomclass method to generate a randomdoublealways returns a number between0.0and1.0
Would you mind fixing it?
Co-authored-by: Kah Goh <villastar@yahoo.com.au>
|
Hey @denerose, thanks for adding the suggested commit. I wasn't sure if you saw the other two comments? |
pull request
This PR updates the hints for Captains Log to clarify the bounds of a ranged call to Random.nextInt (as the test itself can fail obscurely if the upperbound is wrong), and moves the hint for a single param nextInt call to the first task where it is more relevant.
Reviewer Resources:
Track Policies