An example of a continuous random variable is the displacement from the origin of a one-dimensional random walker that steps at random to the right with probability p, but with a step length that is chosen at random between zero and the maximum step length a. The continuous nature of the step length means that the displacement x of the walker is a continuous variable.
We can record the number of times H(x) that the displacement of the walker from the origin after N steps is in a bin of width Δx between x and x + Δx. If the number of walkers that is sampled is sufficiently large, we would find that H(x) is proportional to the estimated probability that a walker is in a bin of width Δx a distance x from the origin after N steps. To obtain the probability, we divide H(x) by the total number of walkers.
In practice, the choice of the bin width is a compromise. If Δx is too big, the features of the histogram would be lost. If Δx is too small, many of the bins would be empty for a given number of walkers, and our estimate of the number of walkers in each bin would be less accurate.
Updated 18 March 2007.