Manchester | 25-ITP-Sep | Khalidbih | Sprint 1| Coursework Sprint-1#823
Manchester | 25-ITP-Sep | Khalidbih | Sprint 1| Coursework Sprint-1#823khalidbih wants to merge 15 commits intoCodeYourFuture:mainfrom
Conversation
…a name yet for the variable
cjyuan
left a comment
There was a problem hiding this comment.
Can you include a brief description of this PR in the PR description?
| // Try breaking down the expression and using documentation to explain what it means | ||
| // It will help to think about the order in which expressions are evaluated | ||
| // Try logging the value of num and running the program several times to build an idea of what the program is doing | ||
|
|
There was a problem hiding this comment.
Can you also try explaining the meaning of each sub-expression?
Math.random()
Math.random() * (maximum - minimum + 1)
Math.floor(Math.random() * (maximum - minimum + 1))
Math.floor(Math.random() * (maximum - minimum + 1)) + minimum
There was a problem hiding this comment.
Math.random(): Gives a random number between 0 and 1.
Math.random() * (maximum - minimum + 1): Stretches the random number so it can cover all the numbers in the range, stretches 0 to 1 into 0 to 100.
Math.floor(Math.random() * (maximum - minimum + 1)): Removes the decimal part so we get a whole number.
Math.floor(Math.random() * (maximum - minimum + 1)) + minimum: Adding the minimum moves all the numbers up, so the lowest equals the minimum I chose.
There was a problem hiding this comment.
Phrases like "a number between X and Y" are not precise enough in a program specification, because they do not clearly state whether the endpoints X and Y are included.
You can consider using the concise and precise interval notation to describe a range of values.
[,]=> inclusion(,)=> exclusion
If -5 < x <= 50, we can say x is a number in the interval (-5, 50].
Can you lookup the return value of Math.random() and describe its return value using this notation?
I did the description for my PR. |
|
Can you respond to all of my comments? You can view all the inline comments on your PR on GitHub (#823). |
I added the brief description to my Pull Request. Thank you for reviewing. |
Sorry, my comments were pending; I forgot to submit the review. Thank you for reviewing my PR. |
|
Changes look good. Well done. |
Thank you so much. |
Self checklist
Changelist :
I have completed all the exercises in sprint 1.