Magic Tools
Utility GuidesBy CooconApril 22, 2026141 views3 min read

How to Use a Random Number Generator: Range Sampling, Batch Generation, and Unique Extraction

Random Number Generators Are Not Just "Drawing a Number"

Many people first think of random number tools for lotteries or guessing games. But in practical use, there are many more specific scenarios: batch generating test numbers, random sampling from a range, assigning numbers, drawing from lists, etc.

MagicTools' random number generator, besides setting minimum and maximum values, also supports batch generation and deduplication.

What Can This Tool Do?

On the random number generator page, you can set:

  • Minimum value Min
  • Maximum value Max
  • Number to generate How many numbers?
  • Whether to deduplicate Unique numbers

After generating results, you can copy them with one click, and batch results are arranged by line breaks, suitable for pasting into tables or documents.

Most Common Uses

Classroom Roll Call or Lottery

If the list is already numbered, simply set the range and generate a random number. If you want to draw multiple numbers without repetition, enable Unique numbers.

Test Data Preparation

Development or testing often requires a batch of random integers, such as order number suffixes, simulated scores, random indices, etc. Here, you can generate multiple sets at once without writing your own scripts.

Random Grouping or Sampling

When conducting surveys, activities, or experiments, you often need to randomly draw several non-repeated values from a numbered range, which is a typical scenario for Unique numbers.

What to Note When Using?

First, the minimum value must be less than the maximum value.
If the range itself is invalid, the tool will directly prompt an error.

Second, in deduplication mode, the number to generate cannot exceed the total numbers in the range.
For example, from 1 to 10, there are only 10 numbers, so you cannot request to generate 20 unique numbers.

Third, it is suitable for integer randomness.
The current page is for integer randomness, not decimal randomness.

  1. First, determine the random range.
  2. Then decide whether to draw 1 number or generate in batch.
  3. If repetition is not allowed, turn on Unique numbers.
  4. After generation, copy the results directly.

Frequently Asked Questions (FAQ)

Q: Why does it prompt that the quantity is invalid after I enable deduplication?

A: Because the quantity you requested is greater than the total number of available numbers, reduce the quantity or expand the range.

Q: Is it suitable for formal lotteries?

A: Suitable for daily draws, demonstrations, and lightweight use. For formal commercial activities, additional documentation and rule explanations are usually required.

Q: What is the maximum number that can be generated at once?

A: The page supports batch generation, which is sufficient for common testing and sampling needs.

Summary

The most practical aspect of a random number generator is that it handles "range, quantity, and whether to deduplicate" cleanly on one page. Whether you are drawing lots, random sampling, or temporarily creating a batch of integer test data, it can be done quickly.

Access link: random number generator page

Related Articles

Blocking rm -rf in Claude Code: A Deny Rule Stopped 14 Deletes in Two Weeks, 7 Other Spellings Still Get Through, and a Hook That Closes the Gap

To keep Claude Code from deleting things by accident, I added a deny rule, Bash(rm -rf *), to my global settings. Across my sessions from October 7 to 21 it blocked 14 deletes. After each denial the model picked a new directory name 8 times and dropped the delete 6 times. It never tried another spelling. Then I replayed 22 delete commands verbatim against Claude Code 2.1.285 through a stub. rm -fr, rm -r -f, rm -Rf and rm -r deleted the directory in manual, auto and bypass mode alike. /bin/rm, find -delete and bash -c deleted it in manual and bypass mode. In auto mode, rm -fr inside the working directory skips the classifier because it 'would be allowed in acceptEdits mode'. A second, built-in dangerous-rm check fires on targets like $D/*, even in bypass mode, but loses track of a variable assignment when a heredoc comes earlier in the same command. The post ends with a PreToolUse hook that blocks every recursive spelling in all three modes and tells the model what to do instead.

claude-codehooks+5
pitfallsOct 21, 20268 min
208

The Self-Reinforcing Flywheel Is Harder Than It Looks: 40 Days of an LLM Auto-Tuning Loop

We ran an 'LLM proposes, code decides' auto-tuning loop on a daily WeChat newsletter for 40 days: 18 versions, 8 rollbacks. Three of those rollbacks overturned decisions a human had made, and one version whose knobs were identical to its parent still got rolled back. Using our real numbers, telling apart a 20% difference needs about 25,000 reads per version. At 60 reads a day, that is more than 400 days. This postmortem covers five reasons the flywheel never turned, and what actually moved the numbers.

wechatpostmortem+4
pitfallsOct 21, 20268 min
133

Dev Breakfast · 2026-10-21

Today's headline: A single "bonsoir, Elliot" makes the model leak its .env: a backdoor for under $50. Plus 4 more: DeepSeek open-sources its inference engine: V4.1 Flash only, and KV cache still missing; TorchTPU goes open source: PyTorch models can run directly on TPU; and more.

daily-intelOct 21, 20268 min
446

Dev Breakfast · 2026-10-20

Today's headline: Should You Merge AI Code You Don't Understand: Settle the Abstraction Layer Yourself First. Plus 4 more: tmux as a Remote Control: Multi-Session Claude Code and send-keys; headroom Goes Open Source: 95% Token Savings on JSON, Only 20% for Coding Agents; and more.

daily-intelOct 20, 20265 min
415

Published by Magic Tools