When an organism's behaviour produces a reward in one stimulus situation (called S+), it typically exhibits that behaviour in similar but recognisably different situations, the ubiquitous phenomenon of stimulus generalisation. Shepard (1987, Science, 237, 1317-1323) proposed a universal law of generalisation based on functional considerations. The problem for the learner is to decide whether a particular stimulus situation has the same consequences of interest (reward-producing) as S+. The animal has learned that S+ is in 'the consequential region'. The problem is: what is the probability that another stimulus, X, is also in the consequential region? Given a range of assumptions about the consequential region, this probability is an exponential function of the appropriately scaled 'distance' x between X and S+: y - e-kx, a curve concave upward in shape. Data from a number of species in a number of experimental paradigms fit this functional prediction. Especially important are recent data from spatial generalisation in honeybees, the only evidence in an inverterbrate animal. Shepard's law suggests that the probabilistic structure of the world has driven the evolution of learning in diverse animals.