Learn how to use the Rafflify RNG API
The Rafflify RNG API provides a simple way to generate random numbers with customizable parameters. It's designed to be easy to use and integrate into your applications.
Base URL: https://rng-api.rafflify.com
Generate a random number within a specified range, with optional exclusions.
{
"start": number, // Optional, default: 1, min: 1, max: 1,000,000,000
"end": number, // Required, min: 1, max: 1,000,000,000
"exclude": number[] // Optional, array of numbers to exclude
}
{
"success": boolean,
"result": number // The generated random number
}
{
"success": false,
"error": string // Error message
}
// Generate a random number between 1 and 100, excluding 50
fetch('https://rng-api.rafflify.com/random-number', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
start: 1,
end: 100,
exclude: [50]
}),
})
.then(response => response.json())
.then(data => {
if (data.success) {
console.log('Random number:', data.result);
} else {
console.error('Error:', data.error);
}
})
.catch(error => {
console.error('Failed to connect to the API:', error);
});
curl -X POST https://rng-api.rafflify.com/random-number \
-H "Content-Type: application/json" \
-d '{"start": 1, "end": 100, "exclude": [50]}'