GET
/v1/shuffle
QuBitLang
Performs a Fisher-Yates shuffle using quantum entropy. Guarantees a cryptographically unbiased permutation - essential for card games, lottery draws, and any fair selection.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| items | string | No | 1,2,...,10 | Comma-separated list of items to shuffle |
Code Examples
shuffle.py
from trueentropy import TrueEntropy
client = TrueEntropy(api_key="te_live_YOUR_KEY")
# Shuffle a deck of cards
deck = [f"{r}{s}" for s in "SHDC" for r in "A23456789TJQK"]
result = client.shuffle(items=deck)
print(result.shuffled[:5])
# ["7H", "KS", "3D", "AC", "9S"]
shuffle.js
import { TrueEntropy } from '@trueentropy/sdk';
const client = new TrueEntropy('te_live_YOUR_KEY');
const result = await client.shuffle({
items: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
});
console.log(result.data.shuffled);
// [7, 3, 9, 1, 5, 10, 2, 8, 4, 6]
shuffle.php
use TrueEntropy\Client;
$client = new Client('te_live_YOUR_KEY');
$result = $client->shuffle([
'items' => '1,2,3,4,5,6,7,8,9,10',
]);
print_r($result->shuffled);
Terminal
curl https://api.trueentropy.net/v1/shuffle \
-H "Authorization: Bearer te_live_YOUR_KEY" \
-G --data-urlencode "items=1,2,3,4,5,6,7,8,9,10"
Response
200 OKJSON
{
"data": {
"shuffled": [7, 3, 9, 1, 5, 10, 2, 8, 4, 6],
"count": 10,
"algorithm": "fisher_yates_quantum"
},
"metadata": {
"request_id": "req_f6a7b8c9d0e1",
"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_f6a7b8c9d0e1",
"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_items | items list is empty or exceeds 10,000 elements |
| 401 | auth_missing | No API key provided |
| 401 | auth_invalid | API key is invalid or revoked |
| 429 | rate_limited | Rate limit exceeded |