-
-
Notifications
You must be signed in to change notification settings - Fork 273
Manchester | 25-ITP-Sep | Khalidbih | Sprint 1| Coursework Sprint-1 #823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…a name yet for the variable
cjyuan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.