Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSean Flanagan
33,235 PointsWould appreciate feedback
2 Answers
Cody Smith
3,818 PointsNice work Sean, I like how you space, it's nice and clean how I code. The only thing to note, I didn't know if you meant to put the + 1 before the (). Because Math object .random() method returns a random number between 0, up to but not including 1. It could possible return 0 * (upper - lower + 1) . But just talking out loud, if you are getting the results of this equation you want, then it's looks good brother.
Justin Blalock
8,206 PointsThey return the same items. Dave's code just uses one less line of code since the addition of the lower parameter technically doesn't have to be done on the same line since it is just basic addition. Nice work Sean on adding the '+1' to the (upper- lower) portion to get the most possible numbers in the random range.
Sean Flanagan
33,235 PointsSean Flanagan
33,235 PointsHi Cody. Thanks for your feedback.
What's the difference between my code and Dave's?
Here's another snapshot including Dave's code:
https://w.trhou.se/sdr6no0qbb
Cheers brother
Sean