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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Anas Rida](https://secure.gravatar.com/avatar/fa0b42f1d496ca1b84e6539862b759be?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Anas Rida
8,183 Pointsthe numbers
why did Joy first call the numbers and then multiplied then by a decimal and then rounded them down?? why not just call the numbers in the array?? Many thanks
edit: I am sorry, the part I am referring to is in the previous video. Mash random numbers. Joy uses a random numbers function to pull varaibles from the array.
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThe idea is to pick a random number. The Math.random function always gives a decimal number between 0 and 1, so if you want a wider choice you multiply it by the number of choices. Then, you round down because you want to use this random choice as an array index, and the index cannot be a decimal.
I'm not sure what you mean by "call the numbers in the array" but I can only assume that there is no function that does it.
Steven Parker
230,688 PointsSteven Parker
230,688 PointsCan you give a time index for this video for what you describe? I'm not seeing anything like that.