Seeded Standard Card Deck Shuffle
This seeded card deck shuffle turns an integer into one exact ordering of all 52 cards in a standard deck.
Run — free
Use the same seed again and you receive the same order, which makes simulations, test fixtures, classroom exercises, and replayable games easier to inspect and share. The result uses compact rank-and-suit codes, includes every card exactly once, and is produced without network access, current time, or hidden randomness. Different seeds ordinarily produce different orders while preserving the same documented deck construction and shuffle procedure.
Create a repeatable shuffle from one integer
Provide one integer in the <code>seed</code> field. The capability first constructs a standard 52-card deck in a fixed canonical order: spades, hearts, diamonds, and clubs, with each suit running from ace through king. It then applies a seeded pseudorandom sequence to a Fisher-Yates shuffle. Because every input to that process is fixed, the resulting deck order is fixed as well. A seed of 42 today produces precisely the same response as a seed of 42 in another request, environment, or test run. That repeatability is the main purpose of this tool. It lets a developer place a shuffled deck in a fixture without storing all 52 values, lets an instructor distribute one shared exercise, and lets a game record the seed needed to reconstruct an initial deal. The seed is returned alongside the deck so saved results remain self-describing. Only safe JSON integers are accepted; decimal values, numeric strings, missing values, infinities, and integers outside JavaScript's exact range are rejected instead of being silently rounded or reinterpreted.
Read the returned card order correctly
The <code>deck</code> array contains exactly 52 unique strings in draw order. Each string joins a rank with a one-letter suit code. Ranks are <code>A</code>, <code>2</code> through <code>10</code>, <code>J</code>, <code>Q</code>, and <code>K</code>. Suits are <code>S</code> for spades, <code>H</code> for hearts, <code>D</code> for diamonds, and <code>C</code> for clubs. Thus <code>AS</code> is the ace of spades and <code>10D</code> is the ten of diamonds. The first array element is the top card, followed by the second card to draw, and so on. The capability does not deal hands, add jokers, rank poker combinations, or mutate the order after returning it. Those decisions belong to the calling application. To deal five cards to four players, for example, consume the first twenty entries according to your chosen dealing pattern. Keeping the output primitive and explicit avoids assumptions about table rules while making the full permutation easy to copy, compare, serialize, or feed into a simulator.
Use deterministic shuffling responsibly
A deterministic shuffle is designed for reproducibility, not secrecy. Anyone who knows the seed and algorithm can reconstruct the entire deck, so this capability is suitable for tests, demonstrations, simulations, puzzles with published seeds, and games where replayability matters more than concealed state. It should not be used to protect wagering, prizes, security decisions, or any situation where predicting future cards would create an advantage. For those cases, use a cryptographically secure source of randomness and keep its state confidential. Within its intended scope, seeded shuffling makes debugging much simpler: include the seed in a failed test report, rerun the exact deal locally, and compare behavior card by card. You can also run batches with consecutive seeds to obtain a stable collection of scenarios without checking large fixture files into source control. The implementation uses no network request, clock, global mutable state, <code>Math.random</code>, or external data. Its fixed deck definition and bounded 51 swap steps make both runtime and output straightforward to audit.
What you can do with it
Reproduce a game bug
Store the seed with a failure report, then recreate the same starting deck while debugging the dealing or scoring logic.
Build stable test fixtures
Generate realistic shuffled orders that remain unchanged across local runs and continuous integration environments.
Share a classroom simulation
Give every participant the same seed so probability exercises begin with an identical deck and can be checked together.
FAQ
What does a request cost?
The API price is $0.002 per request, and the same deterministic shuffle can run free in the browser.
Does the same seed always return the same deck?
Yes. The deck construction, pseudorandom generator, and shuffle steps are fixed, so an accepted seed reproduces the same order.
Which cards are included?
The result includes the 52 standard cards across spades, hearts, diamonds, and clubs, without jokers.
Why was my seed rejected?
The seed must be a JSON integer within the exact safe-integer range. Decimal numbers, strings, missing values, and excessively large integers are invalid.
Is this shuffle suitable for gambling or security?
No. It is intentionally reproducible and therefore predictable to anyone who knows the seed and algorithm.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/game/card-deck-shuffle-seeded \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"seed":42}'const res = await fetch("https://api.kit.forhosting.com/game/card-deck-shuffle-seeded", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"seed": 42
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/game/card-deck-shuffle-seeded",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"seed": 42
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/game/card-deck-shuffle-seeded", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"seed":42}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"seed":42}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/game/card-deck-shuffle-seeded", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"seed": 42
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "game.card_deck_shuffle_seeded",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |