x = random.uniform(0,1)
to include both 0 and 1 in the random number generator limits. Help?
Thanks!
Posted 26 September 2012  10:17 PM
>>> longest=0 3 >>> for i in range(100000): distance = len(str(random.uniform(0,1))[2:]) if distance > longest: longest = distance >>> longest 20
>>> smallest=20 >>> for i in range(200000): distance = len(str(random.uniform(0,1))[2:]) if distance < smallest: smallest = distance >>> smallest 11This experiment showed that the smallest values had 11 digits after the decimal place (I actually ran this one 100,000 times twice because I was amazed to get 11 and thought it might be a fluke). This tells us that we have at least 10 digits worth to play around with. If you did include 1, the odds of actually seeing it within your lifetime (under reasonable usage) are so astronomically small that it hardly seems worth putting it in there.
This post has been edited by atraub: 26 September 2012  10:28 PM
Query failed: unknown local index 'forums_search_posts_main' in search request.
