Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- print '#-------------------------#'
- print '| RANDOM NUMBER GENERATOR |'
- print '#-------------------------#'
- print '\nThis is a Brute-force method. It will test every possible number\nuntil the generated number is found.'
- print "\nThis is a viable method as long as the number of attempts isn't outrageous and you have enough hardware resources.\n"
- print "In other words, the speed of the program is directly related to the number of attempts and your hardware.\n"
- raw_input ("Press ENTER when ready:")
- generated_int = random.randint(0,10000) #Change this number to visualize the time differences
- guess = 0
- while guess <= generated_int:
- print guess
- guess +=1
- if guess == generated_int:
- print 'The generated number is '+str(guess)
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement