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 trialAndrew Perry
5,266 PointsQuestion about Random.Next and Random.NextDouble
Where can you see the range of numbers that Random.Next chooses from, since its a pseudo random number then there are are finite list of numbers it chooses from. Also with Random.NextDouble could it ever be exactly 0.500000000000?
1 Answer
Steven Parker
231,236 PointsPseudo-random does not imply choosing from a list.
That might be one method for generating pseudo-random numbers, but an even more popular method is to employ a mathematical expression that computes a large value and then extract a subset of bits from it.
Predicting if a specific number will be generated by such a method is also difficult. You might be more likely to answer the question by calling the function in a loop and checking against the desired value. It may take very many iterations to prove a "yes", and it may not be possible to be 100% certain about a "no".