Shall I compare thee to a summer’s day? Or perhaps something less flattering? What to do if the muses escape you and you can’t come up with that perfectly poetic insult? Well look no further than the ShakespeareInsult function.
Based on the Shakespeare Insult Kit, the function randomly chooses three words from three columns each containing 50 words. Precede a random combination with a “Thou,” and you have yourself some bard-inspired slander. I modified the code slightly to have it spit out 20 insults per call:
I don’t exactly know why, but I’m reminded of another function that ships with MATLAB… In any event, of the ones I generated, I think that gorbellied tickle-brained lout is my favorite. Brownie points if you can tell me the total number of possible insults given that there are 50 choices for each word. Bigger brownie points if you can tell me how many times I’d have to generate a random insult before I can say with 95% certainty that I’ve seen all of them. Or just sit back, relax, and let the insults fly.
3 CommentsOldest to Newest
n = 125000; % number of coupons p = 0.95; % desired probability t = floor(n*log(n)+(-log(-log(p)))*n); % predicted number required for P(T<t)=p N = 1000; % number of MC % Monte Carlo simulation x = false(1,N); for i = 1:N v = false(1,n); v(randi(n,t,1)) = true; x(i) = all(v); end mean(x+0) % should be close to p