Aller au contenu

Tirage au sort de liste

Mélangez une liste, tirez N éléments au hasard, ou désignez un gagnant - via le CSPRNG du navigateur.

Fonctionne dans votre navigateur

Collez une liste, choisissez un mode : mélanger, tirer N éléments, ou désigner un gagnant. Source aléatoire : crypto.getRandomValues, le CSPRNG du navigateur.

Comment l'utiliser

  1. Paste your list

    One entry per line. Empty lines are ignored.

  2. Pick a mode

    Shuffle, pick N, or pick winner.

  3. Run the draw

    Click Shuffle / Pick. The output is the new order or selection.

Qu'est-ce que c'est ?

A list randomizer takes a sequence of strings and produces a permutation, a sample, or a single random pick. The interesting part isn't the algorithm (Fisher-Yates shuffle, k-out-of-n sampling) - it's the random source. Math.random is fine for a hobby raffle; for anything that has to be defensible, the CSPRNG behind window.crypto.getRandomValues is the right tool.

Quand l'utiliser

Picking a winner from a giveaway. Shuffling a class roster for a presentation order. Sampling 10 lines from a 1000-line log for a manual QA pass. Randomising a playlist when your music app has 'shuffle' but won't reveal the order. Splitting a team into pairs.

Erreurs courantes

Using Math.random for a high-stakes draw - it's not unbiased enough, and on older Safari versions it had known weaknesses. Forgetting that picking from a list with duplicates and asking for 'unique' returns the unique set first; clarify whether 'unique' means by line content or by line position. And running the shuffle, then sorting the output for display, which defeats the point.

FAQ

How random is 'random' here?
Cryptographically secure. We use crypto.getRandomValues which is the browser's CSPRNG - the same one that backs TLS key generation. For raffles, prize draws and anything that has to be auditable, it's more than enough.
Pick N: with or without replacement?
Without replacement by default - each entry can be picked at most once. Toggle 'allow duplicates' to sample with replacement (useful for stress-testing or simulating dice).

Plus dans cette catégorie