# Sample discrete distributions with a good range of observed entropies

For a numerical sanity check, I need to sample random sequences of $$n$$ positive numbers adding up to 1, and having a high chance of observing both high entropy and low entropy sequences. Compute the entropy by treating sequence as a discrete probability distribution.

Ideally, the histogram of sampled sequence entropies would approach uniform distribution.

Can someone suggest a way to do this in Mathematica? Here’s a naive generation method, showing non-uniform entropy histogram, and the kind of histogram I would like to see.

``n = 10; s = 10000; normalize[seq_] := seq/Total@seq;  sequences =    normalize /@ RandomVariate[UniformDistribution[], {s, n}]; entropy[seq_] := -Total[# Log[#] & /@ seq]; Histogram[entropy /@ sequences, PlotLabel -> "observed"] Histogram[RandomVariate[UniformDistribution[], s],   PlotLabel -> "desired"] ``