You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That challenge was funny to solve. Really great exercise to work with random number :)
For the task 2, you ask to generate a registry number that starts with the prefix "NCC-" and then uses a number from 1000 to 9999 (inclusive).
So that code should validates the challenge.
return String.format("NCC-%d", 1000 + this.random.nextInt(9000));
But it doesn't. I had to subtract 1 from 9000 to pass the tests. That means the result is a random number in this range [1000 - 9998] and not [1000 - 9999].
So:
or there's a typo in the instructions and it's not 9999 (inclusive) but 9999 (exclusive)
or the unit test is wrong. The upper bound of this assertion at line 63 is exclusive.
WDYT?
The text was updated successfully, but these errors were encountered:
That challenge was funny to solve. Really great exercise to work with random number :)
Thanks!
And thank you for the feedback. This was also mentioned on the forum today: https://forum.exercism.org/t/issues-with-captains-log-exercise/8412. It's a mistake in the tests; I used my own example solution to find the expected numbers for the seeds used in the tests, but my example solution contains a bug...
Hi,
That challenge was funny to solve. Really great exercise to work with random number :)
For the task 2, you ask to generate a registry number that starts with the prefix "NCC-" and then uses a number from 1000 to 9999 (inclusive).
So that code should validates the challenge.
return String.format("NCC-%d", 1000 + this.random.nextInt(9000));But it doesn't. I had to subtract 1 from 9000 to pass the tests. That means the result is a random number in this range [1000 - 9998] and not [1000 - 9999].
So:
WDYT?
The text was updated successfully, but these errors were encountered: