Chapter 16Random Selection
The generation of random numbers is too important to be left to chance.
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 readers don’t get bored seeing the same ad repeatedly.
Things go well for the first few days, but the application gradually becomes more sluggish. A few weeks later, people are complaining that your website is too slow. You discover it’s not just psychological; you can measure a real difference in the page load time. Your readership is starting to lose interest, and traffic is declining.
Learning from past experiences, you first ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access