Last active
May 19, 2022 23:00
-
-
Save TuxPenguin09/c13268d1047214fa65e40bdc657d4db5 to your computer and use it in GitHub Desktop.
Calculating How Many Random String Until Everything is Mentioned in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
stringAlphabets = "abcdefghijklmnopqrstuvwxyz" | |
stringAvail = [] | |
strAvlength = 0 | |
strLimlength = 0 | |
strErrs = 0 | |
charLength = 15 # Any length of chars | |
limitDone = True | |
while(limitDone): | |
stringRand = "".join(random.choice(stringAlphabets) for _ in range(charLength)) | |
print("Live Count of String Avail: " + str(strAvlength) + " String: " + stringRand + ", Errors: " + str(strErrs), end="\r") | |
if stringRand not in stringAvail: | |
strAvlength = strAvlength + 1 | |
strLimlength = 0 | |
stringAvail.append(stringRand) | |
else: | |
strErrs = strErrs + 1 | |
strLimlength = strLimlength + 1 | |
if strLimlength == 10000: | |
print("\nFinished calculating!") | |
limitDone = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment