I have been working on a silly magic item creator that makes use of diffrent lists with stuff that can happen, feelings, coluers and so on. i have been using random.choice to pick from these lists but somehow the items generated do not really seem random at all.
when i run it 10 times in a row i get stuff like:
A feather that causes horrible visions of an impending disaster, when starring at it
A lamp that makes you feel drunk when you lick a person who has something you want
A feather that makes you feel drunk when you lick a person who has something you want
A dagger that makes you feel drunk when you lick a person who has something you want
A feather that causes horrible visions of an impending disaster, when starring at it
A lamp that glows white when you touch a person thinking of you
A book that makes you feel drunk when you lick a person who has something you want
A cane that makes you feel drunk when you lick a person who has something you want
A marble that makes you feel drunk when you lick a person who has something you want
A needle that makes you feel drunk when you lick a person who has something you want
the first variable, item seems random enough, but from then on it starts repeating it self, the you feel drunk, is one possibility of a list of 10+ possibilities and the lick is from a list of 5.
makesyous = ["sad", "happy", "cold", "warm", "itchy", "laugh", "cough", "sing", "tired", "dizzy", "feel drunk", "uncomfortable", "feel like the opposite gender"]
sences = ["you see", "you smell", "you hear", "you touch", "you lick"]
they are all of them called thorugh a sceries of linked functions (thats is not the order the lilts and functions are wridden in the code, this is just to illustrate how i do stuff)
def generate():
string = "A " + item() + " that " + action()
return string
def item():
x = random.choice(items)
return(x)
def action():
x = random.choice(actions)
return(x)
actions = [short(), makesyou() + " "+ when(), random.choice(dostuff)]
def makesyou():
x = "makes you " + random.choice(makesyous)
return(x)
def when():
x = random.choice(whens) + " " + sence()
return(x)
am i doing somthing wrong (i know my code is horriblei structured, sorry about that) or is the random.choice working as intented?
Aucun commentaire:
Enregistrer un commentaire