Weighted Randomised Selection
Learn about weighted randomized selection for the favorite words.
We'll cover the following
We can improve the behavior of our text generator by updating the process we use to select our next word. Currently, our algorithm is simply choosing a word entirely at random. This is in contrast to the behavior we want—randomly selecting a word but preserving the relative probability of word sequences. The changes to achieve this can be found in the code below:
Get hands-on with 1200+ tech skills courses.