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/ljchg12-hue/dotfiles/tree/main/skills/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.
threat-hunting
Proactive threat detection using Sigma rules, IOCs, and behavioral analytics
auth-implementation-patterns
Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.
debugging-strategies
Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.
sql-optimization-patterns
Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.
monorepo-management
Master monorepo management with Turborepo, Nx, and pnpm workspaces to build efficient, scalable multi-package repositories with optimized builds and dependency management. Use when setting up monorepos, optimizing builds, or managing shared dependencies.
git-advanced-workflows
Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.
Didn't find tool you were looking for?