Random Data and Single Variable Monte Carlo Simulation
Generate seeded uniform real or integer data. Sample a model with one variable to estimate its mean, standard error and integral.
Reproducible random data
The same seed, count and bounds reproduce the same sequence. Real mode generates uniform values. Integer mode includes both endpoints. The first 20 generator outputs are discarded before sampling. The generator uses s = 16807s mod 2147483647. This simple generator is intended for learning and basic sampling, not cryptography, security, lotteries or demanding simulations in many dimensions. Integer conversion uses rejection sampling to avoid remainder bias.
Monte Carlo model
Enter an expression f(x) with one variable. Uniform samples of x between a and b are passed through the model. Their mean estimates the expected output. Multiplying by the interval width estimates the integral. Sample standard deviation uses denominator n − 1. The estimated standard error of the mean is s/√n and the integral error estimate is (b − a)s/√n. These estimates are neither rigorous error bounds nor confidence intervals. Sampling can miss narrow peaks and singularities. Finite samples do not prove that an integral converges.
Limits and example
For constant f(x)=2 over [0,3], all outputs are 2 and the integral is 6. Use 2 to 10000 samples and a seed from 1 to 2147483646. Real bounds have magnitude at most 1e50 and model outputs at most 1e100. Expressions support arithmetic and functions such as sin, cos, exp and log, using radians. The table shows the first 100 rows and CSV includes all rows. Multiple random inputs and correlation are not modelled.
Frequently asked questions
How do you generate a random integer from 1 to 10?
For example, a seeded pseudorandom generator produces 2 integers from 1 through 10, giving 3 then 9 with seed 1. Repeating the seed and settings reproduces the sequence, after initial transitions are discarded and values mapped to a uniform integer range, without providing cryptographic security or physical randomness.
Related calculators
-
Mathematics
Integral Calculator
Compute definite integrals numerically with an error estimate and find antiderivatives symbolically. Every antiderivative is checked by differentiation. -
Statistics and Data Analysis
Data Charts and Moving Average
Create histograms, box plots, scatter plots and trailing moving averages. Download data as CSV and charts as SVG. -
Statistics and Data Analysis
Binomial and Poisson Distributions
Calculate exact count, cumulative and upper tail probabilities, plus the mean and variance of discrete event counts. -
Statistics and Data Analysis
Chi Square Goodness of Fit Test
Calculate a chi square goodness of fit statistic, degrees of freedom and approximate p value from observed and expected counts. -
Statistics and Data Analysis
Confidence Interval for a Mean
Calculate a confidence interval from summary statistics. Use a normal interval for known population deviation or a t interval for sample deviation. -
Statistics and Data Analysis
Descriptive Statistics Calculator
Find the mean, median, modes, sample and population variance, standard deviation, quartiles and percentiles from a data list.
Found a mistake or something missing?
If a value looks wrong, a size is missing or you need a feature, write to us and we will fix it.