Agent skill
random-selection
Randomly select items from lists using various algorithms for fair and unbiased selection
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/random-selection
SKILL.md
Random Selection Skill
Perform random selection with various algorithms for fair, unbiased outcomes.
When to Use
- Prize drawings
- Random sampling
- A/B test group assignment
- Survey participant selection
Core Capabilities
- Simple random selection
- Weighted random selection
- Stratified sampling
- Shuffle/randomize lists
- Unique selection (no duplicates)
- Reproducible randomness (seeded)
Examples
# Bash: Random line from file
shuf -n 1 items.txt
# Python: Simple random
import random
items = ['A', 'B', 'C', 'D']
selected = random.choice(items)
# Python: Multiple unique items
selected = random.sample(items, 2)
# Python: Weighted selection
weights = [10, 5, 3, 1]
selected = random.choices(items, weights=weights, k=1)
# Python: Seeded (reproducible)
random.seed(42)
selected = random.choice(items)
Algorithms
- Uniform: Equal probability
- Weighted: Based on weights
- Reservoir sampling: For streams
- Fisher-Yates shuffle: Unbiased shuffling
Best Practices
- Use cryptographically secure random for security
- Document seed for reproducibility
- Verify distribution for large samples
- Handle edge cases (empty list, single item)
Resources
- Python random: https://docs.python.org/3/library/random.html
- secrets (secure): https://docs.python.org/3/library/secrets.html
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?