Hongmu Notes

Sampling without duplication

Each line is guaranteed to appear at most once, and the result can be directly distributed and used as a list.
100% Browser local processing 0 Data upload

🎲 Sampling settings

💡 Instructions for use

  • Sampling by line number is suitable for "sampling a fixed number of samples"; sampling by proportion is suitable for "sampling a certain proportion of samples", and the proportion is calculated based on the number of sampled rows.
  • The shuffle mode retains all rows and only randomly rearranges the order. It is used for preparation before random sorting and random grouping.
  • When repetition is prohibited, each row can be sampled at most once, and the result can be used directly as a list; when repetition is allowed, it is equivalent to sampling with replacement, and duplicate rows may appear.
  • When retaining the table header, the first row will not participate in sampling, and the results will still start with the table header, making it easy to paste directly back to the spreadsheet software.
  • The result area will provide the number of rows, sampling ratio and selected row number to facilitate one-by-one verification with the original data.
  • The data is only processed in the browser and is not uploaded or saved; if you need to keep the file, please copy or download the results.

Each line is guaranteed to appear at most once, and the result can be directly distributed and used as a list.

Applicable occasions for two kinds of sampling

Non-resampling (no replacement): extracted rows will not appear again. This is used for lottery draws, quota allocation, and sampling verification.

Repeated sampling (with replacement): the same row may be sampled multiple times. Used for simulation scenarios, such as probability experiments and statistical simulation of self-service sampling.

Wrong selection will lead to illogical results: the same person appears twice in the lottery, which is obviously unreasonable.

Why should the order of extraction be disrupted?

If the extraction results are arranged in the order of the original row numbers, the first winner will always come from the front of the list, which is unfair in perception.

After disrupting the output order, the result is more natural and more consistent with the intuition of "random extraction".

Note

When sampling without repetition, the number of extracted rows cannot exceed the total number of rows, otherwise it cannot be satisfied and the tool will usually prompt.

When there are duplicate rows in the data, "no duplication" only ensures that the rows are not duplicated, but does not guarantee that the content is not duplicated; the list itself must be deduplicated first.

Verify

Verification method: Sort the results and check whether there are the same row numbers or the same content.

Confirm again that the number of entries is consistent with the settings and that the output order appears to be random.

"No duplication" only ensures that rows are not duplicated, but does not guarantee that content is not duplicated; the list itself must be deduplicated by person first.

📖 Glossary

random sampling
Select a part of the data as a sample according to random rules, and use the sample to reflect the overall situation.
sample size
The number of rows extracted. The larger the sample size, the closer it is to the whole, but the processing cost is also higher.
Sampling proportion
The sample size is a percentage of the number of rows that can be sampled, often used to draw at a fixed ratio.
Sampling with replacement
The row is put back after each draw, so the same row may be drawn repeatedly.
Sampling without replacement
The extracted rows will no longer participate in subsequent extraction, and each row will appear at most once in the results.
sampling bias
Systematic errors occur when the sample does not represent the whole, for example, only data from a certain time period is taken.
stratified sampling
First group the samples by category, and then sample each group separately so that each category is represented in the sample.
shuffle randomly
It only rearranges the order of rows without deleting any rows. It is often used in preparation before random sorting and grouping.
Winning bank number
The serial number of the selected row in the data is used to check with the original data one by one.
Reproducibility
The property of obtaining the same result under the same conditions. Random sampling is not available by default, and the output needs to be saved to reproduce.

🔗 All keywords and tutorials

Keywords page of the tool12a

Return to tool home page

❓ FAQ

How to choose between two sampling methods?
No duplication is used for lottery and quota allocation; replacement is used for probability simulation.
Why is the output order disrupted??
Otherwise, the results will be arranged according to the original row number, which is unfair in appearance.