Synopsis: Random Selection

Let's learn another antipattern by using an example of displaying advertisements on a website.

You’re writing a web application that displays advertisements. You’re supposed to choose a random ad on each viewing so that all your advertisers have an even chance of showing their ads and so that viewers don’t get bored seeing the same ad repeatedly.

Get hands-on with 1200+ tech skills courses.