Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Generated random values
0.3386666526, -0.5577230558, 0.2609795947, -0.001009749239, 1.164110746, -1.124151720, 1.273710263, -1.511371441, 0.6776124768, -0.3332282196
Student's t-distribution draws
Count generated 10
Degrees of freedom (v) 2
Sample mean 0.01876

What this tool does

This generator produces a list of pseudo-random numbers drawn from a Student's t-distribution with a chosen number of degrees of freedom (v). The t-distribution is a bell-shaped, symmetric distribution that is heavier-tailed than the standard normal. It arises naturally when estimating the mean of a normally distributed population from a small sample with unknown variance, and it underpins the t-test and confidence intervals. As v grows large the t-distribution converges to the standard normal \(\mathcal{N}(0,1)\). This is a pure-mathematics tool with no regional assumptions.

Histogram of generated samples approximating a smooth t-distribution curve
Generated samples form a histogram that approximates the bell-shaped t-distribution.

How to use it

Enter the degrees of freedom v (any real number greater than 0; the default is 2) and the number of random values you want (an integer from 1 to 1000; the default is 10). Press calculate and a fresh list of t-distributed draws is returned. Because the underlying uniform draws are random, you get different numbers on every run, but they always follow the same target distribution.

The formula explained

The density is \(f(x,v) = \dfrac{\left(1 + x^{2}/v\right)^{-(v+1)/2}}{\sqrt{v}\,B\!\left(\tfrac{1}{2}, \tfrac{v}{2}\right)}\), where \(B\) is the Beta function. To sample efficiently we use the classic representation: draw \(Z\) from a standard normal and \(C\) from a chi-square with v degrees of freedom, then $$T = Z \cdot \sqrt{\frac{v}{C}}$$ is exactly t-distributed. Internally \(Z\) comes from the Box-Muller transform and \(C\) from a \(\text{Gamma}(v/2, 2)\) sampler (Marsaglia-Tsang), valid for any real \(v > 0\).

Advertisement
Flowchart showing a normal sample and a chi-squared sample combined to form a t-distributed value
Each t-distributed value combines a standard normal draw Z with a chi-squared draw C scaled by the degrees of freedom.
Bell-shaped Student's t-distribution curve compared with a normal curve, showing heavier tails
The Student's t-distribution (solid) has heavier tails than the normal distribution (dashed), especially for low degrees of freedom.

Worked example

With v = 2, suppose one run gives \(Z = 0.50\) and a chi-square draw \(C = 1.20\). Then $$T = 0.50 \cdot \sqrt{\frac{2}{1.20}} = 0.50 \cdot 1.29099 = 0.6455.$$ A second pair \(Z = -1.10\), \(C = 3.00\) gives \(T = -0.8982\), and a third \(Z = 0.20\), \(C = 0.40\) gives \(T = 0.4472\). These three values illustrate a sample for count = 3.

Advertisement

FAQ

Why are some values huge? For \(v \le 1\) the mean is undefined and for \(v \le 2\) the variance is infinite, so large-magnitude draws are expected, not errors.

Why do results change each run? Each draw uses fresh random uniforms, so the list differs every time while still following the t-distribution.

What if v is very large? The distribution behaves almost identically to a standard normal \(\mathcal{N}(0,1)\).

Last updated: