▶ Random Everything - 100+ Free Generators // v2.8.1
root@generate-random:~/random-sample$ _

Random Sample Generator

Draw a simple, systematic or stratified random sample from a number range or your own list

[ Random Sample Generator - Quick Summary ]

What: Draws a random sample of up to 10,000 units from a number range (for example 1 to 5,000) or from a pasted list of up to 10,000 lines. Four methods: simple random sampling, sampling with replacement, systematic sampling and stratified sampling with proportional or equal allocation.

When to use: Picking survey respondents, audit samples of invoices or records, quality-control checks, selecting participants for a study, classroom statistics exercises, A/B test groups.

Example: Population 1-500, sample 5 → 2, 185, 335, 355, 416

Important: Each method shows what was done (sampling fraction, interval and random start, sample per group), so you can document the sample in a report.

Our random sample generator selects a statistically sound sample in one click. Enter a population as a number range (record IDs, row numbers, invoice numbers) or paste a list of names or items, set the sample size and choose a method: simple random sampling (every unit equally likely, no repeats), sampling with replacement, systematic sampling (random start, then every k-th unit) or stratified random sampling (a separate simple random sample inside each group, sized proportionally or equally). The result lists the selected units with their position in the population, plus the sampling fraction and the per-group breakdown. Export to text, CSV or JSON. Free, no signup.

What is a Random Sample?

A random sample is a subset of a population chosen by chance, so that the people or items you study represent the whole group. In a simple random sample, every unit has the same probability of selection and every possible sample of that size is equally likely - the basis of most statistical inference.

When the population has groups that must all be represented (departments, regions, age bands), a stratified random sample draws a simple random sample inside each group. Systematic sampling is a quicker alternative for ordered lists: pick a random starting point, then take every k-th unit.

Sampling Methods

Simple Random Sampling (without replacement)

Every unit has the same chance n / N of being selected and no unit can be selected twice. The standard choice for surveys, audits and experiments.

Sampling With Replacement

Each draw is independent and selected units go back into the population, so a unit can appear more than once. Used for bootstrapping and for simulations of independent draws. The sample size can exceed the population size.

Systematic Sampling

The interval is k = N / n, rounded down. A random start r is chosen between 1 and k, and the sample is r, r + k, r + 2k, and so on. Simple and evenly spread, but avoid it when the list has a pattern that repeats every k units.

Stratified Random Sampling

Paste one unit per line as item, group (or tab-separated, straight from a spreadsheet). Proportional allocation gives each group a share of the sample equal to its share of the population, rounded with the largest-remainder method so the total is exactly n. Equal allocation gives every group the same number; a group smaller than its share contributes all its units and the rest goes to the other groups.

Population as a Range or a List

A range (from - to, up to a billion units) is ideal when your records are numbered: sample the numbers, then pull those rows or IDs. A list (up to 10,000 lines) returns the selected items themselves, each with its line number.

How to Draw a Random Sample

[STEP 1] Choose a Method

Simple, with replacement, systematic or stratified.

[STEP 1] Define the Population

Enter a number range or paste your list. For stratified sampling, add the group after each item.

[STEP 1] Draw and Export

Set the sample size and click "Draw Sample". Keep it sorted in population order or in draw order, then copy or export to CSV.

Common Uses for Random Sampling

  • › Surveys: Choose which customers or employees receive a questionnaire
  • › Audits: Select invoices, expense claims or transactions to review
  • › Quality Control: Pick units from a production batch for inspection
  • › Research: Recruit study participants from a sampling frame
  • › Teaching Statistics: Show how simple, systematic and stratified samples differ on the same population
  • › Data Work: Pull a random subset of rows to check a large dataset by hand

Random Sampling Best Practices

  • _ Make sure the population list (the sampling frame) is complete before you sample
  • _ Use stratified sampling when small groups must be represented
  • _ Avoid systematic sampling on lists sorted in a repeating pattern
  • _ Record the method, population size and sample size alongside your results (export JSON keeps them)
  • _ Decide the sample size before drawing, and do not redraw until you like the result

Technical Implementation

All selections use PHP's random_int(), which draws from the operating system's secure random source. Simple samples use a partial Fisher-Yates shuffle (or, for small samples from very large ranges, rejection of repeats), which makes every subset of size n equally likely.

// Simple random sample: partial Fisher-Yates over positions 1..N
for ($i = 0; $i < $n; $i++) {
    $j = random_int($i, $N - 1);
    [$pool[$i], $pool[$j]] = [$pool[$j], $pool[$i]];
}
$sample = array_slice($pool, 0, $n);

// Systematic: k = floor(N / n), random start r in 1..k
$sample = [r, r + k, r + 2k, ..., r + (n - 1)k];

// Stratified, proportional: n_h = n * N_h / N, largest remainder
// so that the group samples add up to exactly n

API Access for Developers

GET https://generate-random.org/api/v1/generate/random-sample
VIEW FULL API DOCUMENTATION →

Frequently Asked Questions

What is the difference between simple and stratified random sampling? ▶
A simple random sample treats the population as one group: every unit has the same chance. A stratified sample first splits the population into groups (strata) and draws a simple random sample inside each one, which guarantees every group is represented and usually gives more precise estimates when the groups differ.
Sampling with or without replacement - which should I use? ▶
Without replacement (the default) for surveys, audits and selecting people: no one is picked twice. With replacement when each draw must be independent, for example bootstrapping or simulating repeated draws.
How is the systematic sampling interval chosen? ▶
The interval k is the population size divided by the sample size, rounded down. The start is a random number between 1 and k, so every unit in the first interval is equally likely to start the sample.
How big can the population and the sample be? ▶
A number range can go up to a billion units; a pasted list up to 10,000 lines. A sample can contain up to 10,000 units.
How do I sample rows from Excel or Google Sheets? ▶
If the rows are numbered, sample the range (for example 2 to 1,501) and filter those row numbers. Or copy the column into the list box; for stratified sampling copy two columns (item and group) and choose the Tab separator.
Is my list stored? ▶
No. The list is sent to our server in the body of the request only to draw the sample, and is never stored.

[ HOW TO CITE THIS PAGE ]

APA Style:
Generate-Random.org. (2026). Random Sample Generator. Retrieved from https://generate-random.org/random-sample
Web Citation:
Random Sample Generator - Generate-Random.org (https://generate-random.org/random-sample)