Say I have 3 words and a frequency of them occurring in a piece of text.
For example:
be (1)
not (1)
have (2)
Since the total frequency of all the words is 4, I generate a random number between 0-3 or 1-4. How would I use this random number so that the program outputs "be" 1/4 of the time, "not" 1/4 of the time, and "have" 1/2 of the time?
Aucun commentaire:
Enregistrer un commentaire