Counterfeit or substandard medicines adversely affect the health of millions of people and cost an estimated $200 billion USD annually. Their burden is greatest in developing countries, where the World Health Organization estimates that one in ten medical products are fake. In this work, I describe a simple addition to the existing drug manufacturing process that imparts an edible universally unique physical identifier to each pill, tablet, capsule, caplet, etc. This technique uses nonpareils (also called sprinkles and "hundreds and thousands"), tiny inexpensive multicolor candy spheres that are normally added to other candies or desserts as decorations. If nonpareils are applied at random to a pill immediately after manufacture, the specific pattern they form is unlikely to ever be repeated by random chance; this means that the pattern (or "CandyCode") can be used to uniquely identify the pill and distinguish it from all other pills. By taking a photograph of each CandyCoded pill after manufacture and recording the location and color of each nonpareil, a manufacturer can construct a database containing the CandyCodes of all known-authentic pills they produce. A consumer can then simply use a cellphone to photograph a pill and transfer its image to the manufacturer's server, which determines whether the pill's CandyCode matches a known-good CandyCode in their database (meaning that the pill is authentic) or does not have a match in the database (in which case the consumer is warned that the pill may be counterfeit and should not be consumed). To demonstrate the feasibility of using random particles as universal identifiers, I performed a series of experiments using both real CandyCodes (on commercially produced chocolate candies) and simulated CandyCodes (generated by software). I also developed a simple method for converting a CandyCode photo to a set of strings for convenient storage and retrieval in a database. Even after subjecting CandyCodes to rough handling to simulate shipping conditions, the CandyCodes were still easily verifiable using a cellphone camera. A manufacturer could produce at least [Formula: see text] CandyCoded pills-41 million for each person on Earth-and still be able to uniquely identify each CandyCode. By providing universally-unique IDs that are easy to manufacture but hard to counterfeit, require no alteration of the existing drug formulation and minimal alteration of the manufacturing process, and need only a cameraphone for verification, CandyCodes could play an important role in the fight against fraud in pharmaceuticals and many other products.