Random Quote Generator
Display random famous quotes from 100+ curated authors. Copy, favorite, filter by category, and browse quote history instantly.
Click "New Quote" to begin.
No favorites yet. Click the heart icon to save quotes.
About
A curated corpus of 100+ verified quotes from philosophers, scientists, writers, and leaders spanning 2500 years of recorded thought. Each quote is attributed with author and approximate year. The selection algorithm uses a shuffle-based approach to guarantee every quote appears exactly once before any repetition occurs - unlike naive Math.random calls that produce clustering and repeats. Category filtering narrows the pool before shuffling. Favorites persist across sessions via LocalStorage. Note: attribution of ancient quotes is approximate and may reflect popular consensus rather than verified primary sources.
Formulas
The selection mechanism avoids naive random indexing, which produces a probability of repeat within n draws from a pool of N quotes:
Instead, a Fisher-Yates shuffle is applied to the index array, producing a permutation where each element occupies each position with uniform probability 1N. The algorithm iterates from index i = N β 1 down to 1, swapping each element with a randomly chosen element at index j where 0 β€ j β€ i. Time complexity is O(N), space complexity O(1) in-place.
Where N = total quotes in active pool, n = number of draws, i = current iteration index, j = random swap target index.
Reference Data
| Category | Count | Era Range | Notable Authors |
|---|---|---|---|
| Philosophy | 18 | 469 BCE - 1900 | Socrates, Nietzsche, Confucius |
| Science | 16 | 1564 - 2018 | Einstein, Curie, Hawking |
| Literature | 18 | 1564 - 1965 | Shakespeare, Wilde, Tolkien |
| Leadership | 14 | 1809 - 2014 | Lincoln, Mandela, Churchill |
| Art & Music | 10 | 1452 - 1980 | Da Vinci, Picasso, Lennon |
| Wisdom | 12 | 620 BCE - 1948 | Lao Tzu, Gandhi, Rumi |
| Humor | 10 | 1835 - 1994 | Twain, Groucho Marx, Wilde |
| Motivation | 12 | 1880 - 2011 | Roosevelt, Keller, Jobs |