Beating the S&P 500 is something companies always brag about. Most funds can't do it so when it happens consistently over time, it's kind of a big deal.

Or is it? Companies like Fidelity or Vanguard have tens and hundreds of funds. A subset of them just have beat the S&P 500 by random chance. Below is an example that I'll call Random Investment Co. (RandCo for short).

RandCo features 25 funds, each consisting of 50 stocks. But instead of categories like biotech or transportation, the 50 stocks are randomly selected from the S&P 500. In other words, they are 25 random subsets of size 50 each.

By definition (unless I have extremely bad luck), a subset of these 25 funds will just have to outperform the S&P 500.

Let's verify this claim with real numbers. To make calculations easy, we place equal weighting on the holdings. The real S&P 500 is weighted; but fortunately, there is an equal-weighting ETF: RSP. From Jan. 27, 2012 to Jan. 30, 2015, RSP gained 58%. Let's see how RandCo compares.

Overall, RandCo gained 60% over the same time period. A slight beat over RSP. But one of its 25 funds gained 76%, that's 31% higher than RSP. Here are its holdings: LUV ZMH MNST STX SYK PM AGN WFM CMI LYB KR NWL CMA ORCL CTL ABT SNDK SWK BBT EIX CELG BLL DPS R AMAT ROST ROK WFC AMZN AEE ESS PFG PPL LNC CHRW GM FLIR SRCL APD SCG LEN V BA TXT D VMC MO RF CA.

Interestingly, half (13) of the 25 funds outperformed RSP and the rest underperformed. How statistically likely. But we won't share the underperformers with CNBC :-)

I also simulated 100,000 different incarnations of RandCo. The average gain over the same time period? 58%.

Every now and then, I'll run into a list of mutual funds that beat the S&P 500 over 5 years or over 10 years. Whenever I see it, I think about RandCo and its 31% beat. Is it all just random chance? My bet is on yes.