Home
cd ../playbooks
ProductivityBeginner

Raffle Winner Picker

Randomly select winners from Google Sheets, CSVs, or lists for giveaways with transparent, verifiable selection.

5 minutes
By communitySource
#raffle#giveaway#random#selection#google-sheets
CLAUDE.md Template

Download this file and place it in your project folder to get started.

# Raffle Winner Picker

## Your Role
You help run fair, transparent raffles and giveaways. You randomly select winners from lists of entries, support weighted entries, and provide verification for transparency.

## Input Handling

### Supported Formats

**Simple list (one per line):**
```
john@email.com
jane@email.com
bob@email.com
```

**CSV with names:**
```csv
name,email
John Doe,john@email.com
Jane Smith,jane@email.com
```

**Weighted entries:**
```csv
name,email,entries
John Doe,john@email.com,1
Jane Smith,jane@email.com,5
```

**JSON array:**
```json
[
  {"name": "John", "email": "john@email.com"},
  {"name": "Jane", "email": "jane@email.com"}
]
```

### Data Validation
- Check for duplicates
- Validate email formats (if emails)
- Count total entries vs unique participants
- Flag potential issues

## Selection Methods

### Equal Probability
Each unique entry has the same chance:
```python
import random
winner = random.choice(entries)
```

### Weighted Selection
More entries = higher probability:
```python
import random
# Expand entries based on weight
weighted_pool = []
for entry in entries:
    weighted_pool.extend([entry] * entry['entries'])
winner = random.choice(weighted_pool)
```

### Without Replacement
Each person can only win once:
```python
winners = random.sample(entries, k=num_winners)
```

## Verification

### Random Seed
For reproducibility and transparency:
```python
import random
import time

seed = int(time.time() * 1000) % (2**32)
random.seed(seed)
# Store seed for verification
```

### Hash Verification
Create verifiable record:
```python
import hashlib
import json

drawing_data = {
    "timestamp": "2026-01-24T14:32:15Z",
    "entries": entries,
    "seed": seed,
    "winners": winners
}
verification_hash = hashlib.sha256(
    json.dumps(drawing_data, sort_keys=True).encode()
).hexdigest()
```

## Output Format

```markdown
# Raffle Results

## Drawing Information
- **Event:** [Name of raffle/giveaway]
- **Date/Time:** [ISO timestamp] UTC
- **Conducted by:** [Name/Organization]

## Entry Statistics
- **Total Entries:** [X]
- **Unique Participants:** [X]
- **Entry Range:** [min]-[max] entries per person

## Selection Method
- **Type:** [Equal/Weighted]
- **Duplicates Allowed:** [Yes/No]
- **Random Seed:** [seed value]

---

## Winners

### Prize Winners
| Place | Name | Email | Entries |
|-------|------|-------|---------|
| 1st Prize | [Name] | [email] | [X] |
| 2nd Prize | [Name] | [email] | [X] |
| 3rd Prize | [Name] | [email] | [X] |

### Backup Winners
In case prize winners cannot claim:
| Order | Name | Email | Entries |
|-------|------|-------|---------|
| Backup 1 | [Name] | [email] | [X] |
| Backup 2 | [Name] | [email] | [X] |

---

## Verification

### Method
Winners selected using cryptographically seeded random selection.
Seed derived from: [timestamp/method]

### Verification Hash
```
[SHA-256 hash of drawing data]
```

### How to Verify
To verify this drawing, recreate with:
- Same entry list
- Same seed value
- Same selection method

---

## Notes
- [Any exclusions or special rules]
- [Eligibility requirements]
- [Claim deadline]

## Signature
Drawing conducted by: [Name]
Date: [Date]
```

## Scripts

### Python Selection Script
```python
#!/usr/bin/env python3
"""
Raffle Winner Picker
Transparent, verifiable random selection
"""

import csv
import random
import hashlib
import json
from datetime import datetime

def load_entries(filename):
    """Load entries from CSV"""
    entries = []
    with open(filename, 'r') as f:
        reader = csv.DictReader(f)
        for row in reader:
            entry = {
                'name': row.get('name', ''),
                'email': row.get('email', ''),
                'entries': int(row.get('entries', 1))
            }
            entries.append(entry)
    return entries

def select_winners(entries, num_winners, weighted=True, seed=None):
    """Select random winners"""
    if seed is None:
        seed = int(datetime.now().timestamp() * 1000) % (2**32)

    random.seed(seed)

    if weighted:
        pool = []
        for entry in entries:
            pool.extend([entry] * entry['entries'])
    else:
        pool = entries.copy()

    winners = []
    for _ in range(num_winners):
        if not pool:
            break
        winner = random.choice(pool)
        winners.append(winner)
        # Remove all instances of winner
        pool = [e for e in pool if e['email'] != winner['email']]

    return winners, seed

def generate_report(entries, winners, backups, seed):
    """Generate verification report"""
    data = {
        'timestamp': datetime.utcnow().isoformat() + 'Z',
        'total_entries': sum(e['entries'] for e in entries),
        'unique_participants': len(entries),
        'seed': seed,
        'winners': winners,
        'backups': backups
    }

    verification_hash = hashlib.sha256(
        json.dumps(data, sort_keys=True).encode()
    ).hexdigest()

    return data, verification_hash

# Usage
if __name__ == '__main__':
    entries = load_entries('entries.csv')
    winners, seed = select_winners(entries, num_winners=3)
    backups, _ = select_winners(
        [e for e in entries if e not in winners],
        num_winners=2,
        seed=seed+1
    )
    data, hash = generate_report(entries, winners, backups, seed)
    print(json.dumps(data, indent=2))
    print(f"Verification hash: {hash}")
```

### Bash One-Liner
```bash
# Simple random selection from file
shuf -n 3 entries.txt

# With seed for reproducibility
shuf --random-source=<(yes 12345) -n 3 entries.txt
```

## Instructions

1. Load and validate entry data
2. Confirm selection parameters
3. Generate random seed
4. Perform selection
5. Generate verification report
6. Provide results in clear format
7. Offer export options

## Commands

```
"Pick X winners from [file/list]"
"Weighted selection based on entries"
"Select with backup winners"
"Verify this drawing"
"Re-run with same seed"
"Export results as CSV"
"Generate public announcement"
```

README.md

What This Does

Randomly select winners from a list of entries - whether from Google Sheets, a CSV file, or pasted text. Transparent selection with optional verification and backup winners.


Quick Start

Step 1: Create a Raffles Folder

mkdir -p ~/Documents/Raffles

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ~/Documents/Raffles/

Step 3: Prepare Your Entries

Export from Google Sheets as CSV, or create entries.csv:

name,email,entries
John Doe,john@email.com,1
Jane Smith,jane@email.com,3
Bob Wilson,bob@email.com,1

Step 4: Run Claude Code

cd ~/Documents/Raffles
claude

Say: "Pick 3 winners from my raffle entries"


Example

Input (entries.csv):

name,email,entries
Alice Johnson,alice@email.com,1
Bob Smith,bob@email.com,2
Carol White,carol@email.com,1
David Brown,david@email.com,1
Eva Green,eva@email.com,3

Output:

## Raffle Results

**Drawing Date:** 2026-01-24 14:32:15 UTC
**Total Entries:** 8 (5 unique participants)
**Winners Drawn:** 3

### Winners

| Place | Name | Email |
|-------|------|-------|
| 1st | Eva Green | eva@email.com |
| 2nd | Bob Smith | bob@email.com |
| 3rd | Alice Johnson | alice@email.com |

### Backup Winners
| Place | Name | Email |
|-------|------|-------|
| Backup 1 | David Brown | david@email.com |
| Backup 2 | Carol White | carol@email.com |

### Verification
- Random seed: 7829341
- Method: Cryptographically secure random

Entry Formats

Simple List

john@email.com
jane@email.com
bob@email.com

CSV with Names

name,email
John Doe,john@email.com
Jane Smith,jane@email.com

Weighted Entries

name,email,entries
John Doe,john@email.com,1
Jane Smith,jane@email.com,5

(Jane has 5x the chance of winning)


Features

Feature Description
Weighted entries Multiple entries per person
Backup winners Alternates if winner can't claim
Deduplication Option to remove duplicates
Verification Timestamp and random seed
Export Results as CSV or markdown

Selection Methods

Equal Chance

Everyone has the same probability:

"Pick 3 winners with equal chances"

Weighted by Entries

More entries = higher probability:

"Pick winners weighted by entry count"

No Repeat Winners

Each person can only win once:

"Pick 3 different winners (no duplicates)"

Output Format

## Raffle: [Event Name]

### Drawing Information
- **Date/Time:** [timestamp]
- **Total Entries:** [number]
- **Unique Participants:** [number]
- **Winners Selected:** [number]

### Winners
[Ordered list with contact info]

### Backup Winners
[Additional selections in order]

### Verification Hash
[For transparency/auditing]

### Method
[Description of random selection process]

Tips

  • Save the seed: For reproducible results if questioned
  • Draw backups: Always have alternates ready
  • Document everything: Timestamp, method, results
  • Announce publicly: Builds trust in the process
  • Check eligibility: Verify winners before announcing

Commands

"Pick 3 winners from entries.csv"
"Draw a winner with weighted entries"
"Select 5 winners plus 3 backups"
"Pick from this list: [paste names]"
"Generate verification report"
"Re-draw using the same seed"
"Export results as CSV"

Troubleshooting

Duplicate entries Ask: "Remove duplicate emails before drawing"

Need proof of randomness Say: "Include cryptographic verification"

Winner is ineligible Ask: "Move to backup winner #1"

$Related Playbooks