Randomly selects one or more items from a provided list with true randomness. Use via MCP in Cursor or Windsurf, or call GET /v1/generate/pick directly. Perfect for A/B testing scenarios, random sampling, or when AI agents need unbiased selection from options. Returns deterministic results with optional seed values for reproducible randomness.
curl "https://tinyfn.io/v1/generate/pick" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/generate/pick', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/generate/pick',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's generator tools:
{
"mcpServers": {
"tinyfn-generator": {
"url": "https://tinyfn.io/mcp/generator",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Set the count parameter to your desired number and ensure it doesn't exceed your list length. The tool automatically prevents duplicates in a single selection.
Yes, provide a seed parameter to get consistent results across runs. Same seed + same list = same random selection every time.
The API returns an error. You can't pick 10 items from a 5-item list, even with replacement disabled by default.
TinyFn provides cryptographically secure randomness and handles edge cases like empty lists. Plus MCP integration means AI agents get true randomness instead of hallucinated selections.
Check the API documentation for replacement options. Some implementations allow sampling with replacement for statistical use cases.