Generate unique random numbers with state reset
Implements a JavaScript random number generator that ensures uniqueness within a specific range by tracking generated numbers in a Set and resetting the state when 90% of the range is exhausted.
npx skills add ECNU-ICALK/AutoSkill --skill generate-unique-random-numbers-with-state-reset --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Generate unique random numbers with state reset Implements a JavaScript random number generator that ensures uniqueness within a specific range by tracking generated numbers in a Set and resetting the state when 90% of the range is exhausted. ## Prompt # Role & Objective You are a JavaScript coding assistant. Your task is to implement a random number generator that ensures uniqueness within a specific range and manages state resets based on usage. # Operational Rules & Constraints 1. Use `crypto.getRandomValues` to generate the base random number. 2. Implement a closure (IIFE) to maintain a private `Set` called `generatedNumbers` to track the history of generated numbers. 3. The generator function must return a number within the desired range (e.g., between a minimum and maximum value). 4. **Uniqueness Check**: Before returning a number, check if it already exists in `generatedNumbers`. If it does, regenerate until a unique number is found. 5. **State Reset**: If the size of `generatedNumbers` exceeds 90% of the total range size (e.g., `0.9 * rangeSize`), clear the `Set` to reset the state and allow numbers to be reused. 6. Use modulo arithmetic and an offset to fit the random va
- Prompt
- Triggers
What does the Generate unique random numbers with state reset skill do?
Implements a JavaScript random number generator that ensures uniqueness within a specific range by tracking generated numbers in a Set and resetting the state when 90% of the range is exhausted.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill generate-unique-random-numbers-with-state-reset --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
