GET
/v1/integers
QuBitLang
Returns an array of true quantum random integers within a specified range. Perfect for dice rolls, lottery draws, game mechanics, and statistical sampling.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| count | integer | No | 1 | Number of integers to generate (1–10,000) |
| min | integer | No | 0 | Minimum value (inclusive) |
| max | integer | No | 100 | Maximum value (inclusive) |
| unique | boolean | No | false | If true, no duplicate values (requires max-min+1 ≥ count) |
| sort | string | No | none | Sort order: none, ascending, descending |
Code Examples
integers.py
from trueentropy import TrueEntropy
client = TrueEntropy(api_key="te_live_YOUR_KEY")
result = client.integers(
count=5,
min=1,
max=100,
unique=True
)
print(result.values)
# [47, 82, 13, 91, 56]
print(result.metadata.qubitlang_circuit)
# "qrng_hadamard_v2.3"
integers.js
import { TrueEntropy } from '@trueentropy/sdk';
const client = new TrueEntropy('te_live_YOUR_KEY');
const result = await client.integers({
count: 5,
min: 1,
max: 100,
unique: true
});
console.log(result.data.values);
// [47, 82, 13, 91, 56]
integers.php
use TrueEntropy\Client;
$client = new Client('te_live_YOUR_KEY');
$result = $client->integers([
'count' => 5,
'min' => 1,
'max' => 100,
'unique' => true,
]);
print_r($result->values);
// [47, 82, 13, 91, 56]
Terminal
curl https://api.trueentropy.net/v1/integers \
-H "Authorization: Bearer te_live_YOUR_KEY" \
-G -d "count=5&min=1&max=100&unique=true"
Response
200 OK
JSON
{
"data": {
"values": [47, 82, 13, 91, 56],
"count": 5,
"min": 1,
"max": 100,
"unique": true,
"sort": "none"
},
"metadata": {
"request_id": "req_a1b2c3d4e5f6",
"timestamp": "2026-03-09T15:42:17Z",
"qubitlang_circuit": "qrng_hadamard_v2.3",
"qubitlang_version": "1.4.0",
"quantum_backend": "ibm_fez",
"nist_verified": true,
"certificate_id": "cert_a7f2b9c4d8e1",
"powered_by": "QuBitLang"
}
}
Response Headers
X-QuBitLang-Circuit: qrng_hadamard_v2.3
X-QuBitLang-Version: 1.4.0
X-Quantum-Backend: ibm_fez
X-NIST-Verified: true
X-RateLimit-Remaining: 47
X-RateLimit-Reset: 1741536180
Errors
| Status | Code | Description |
|---|---|---|
| 400 | invalid_count | count must be between 1 and 10,000 |
| 400 | invalid_range | min must be less than max |
| 400 | unique_impossible | Unique values requested but range too small |
| 401 | auth_missing | No API key provided |
| 401 | auth_invalid | API key is invalid or revoked |
| 429 | rate_limited | Rate limit exceeded |