I am trying to find a way around a problem in a project which sort of "Cripples" any random function but we are allowed to find a way around it and use that code. I am using strings for this.
I have tried multiple sources where I looked at seeds and randString.
import random
def randString(length=5):
letters='rps'
return ''.join((random.seed(letters) for i in range(length)))
print ("Random String with specific letters ", randString() )
print ("Random String with specific letters ", randString(5) )
I expect a random letter from 'rps' but due to the crippled random, I get repeated 'r'. ex.'rrrrrrrrrrrrrrr'
Aucun commentaire:
Enregistrer un commentaire