ランダム文字列生成
英数字・記号のランダム文字列をまとめて生成。トークンやテストデータに。
ランダム文字列生成とは
ランダム文字列生成ツールとは、英数字や記号を組み合わせた予測不能な文字列を作るツールです。ブラウザの暗号学的乱数を使うため、トークン・パスワード・テストデータの作成に適しています。
🔒 処理はすべてブラウザ内で完結し、データは送信されません。
このツールの前提
- 処理場所
- このページのブラウザ内(JavaScript / Canvas)
- アップロード
- なし — ファイルは端末の外に出ません
- オフライン
- ページを開いた後は通信不要
Entropy is a calculation you can do
Strength is length × log2(size of the alphabet). Twelve characters from 62 alphanumerics is about 71 bits; twelve from 94 printable ASCII is about 78; twenty-four from 62 is about 143. Doubling the length squares the search space, which is why length dominates every other choice.
If the string will be a token, an API key or a password reset code, the number that matters is bits of entropy against the threat model — 128 bits is the usual floor for anything long-lived, and 64 bits is only acceptable for short-lived single-use values.
Which random source is used
Characters are drawn with crypto.getRandomValues, the platform CSPRNG. Math.random is never acceptable for a token: it is a fast PRNG seeded from a small state, and its output is predictable from a handful of samples.
Modulo bias is the subtle bug in naive implementations. Taking a random byte modulo 62 favours the first few characters slightly, because 256 is not a multiple of 62. Rejection sampling removes the bias, and for a 128-bit token the difference does not matter — but for a 4-digit code it does.
Reading the result out loud
If a human has to transcribe the string, drop the ambiguous characters (0/O, 1/l/I) even at the cost of a few bits, and group the output in fours. A 20% entropy reduction is cheaper than a support ticket caused by a mistyped character.
For anything that will be typed back, also avoid starting or ending with a symbol, avoid double characters at the boundary of a group, and consider a word-based scheme — four random words from a 7,776-word list is about 51 bits and vastly easier to read out.
使い方
- 1.文字セット・長さ・生成数を選ぶ
- 2.「実行する」をクリック
- 3.文字列をコピー
ランダム文字列生成の仕組み
ランダム系ツールは、文字列・色・ユーザー・アバターなどのサンプルデータをブラウザの乱数源から作ります。モックやテストデータ用であり、攻撃者に対して予測不能である必要がある用途向けではありません。
- 1
プラットフォームの乱数源から取る
予測不能性が必要な値(トークン)は crypto.getRandomValues から、不要な値(サンプル名)はシード付き PRNG から取ります。
- 2
テンプレートに流し込む
同梱の語彙リストやパターンから組み立てるため、実在の人物データのふりをせずに、それらしい出力になります。
- 3
コピーまたはダウンロードを提供
すべてページ内に留まり、生成した内容を記録することはありません。
処理の流れ
サンプルデータは実データではない
生成された氏名・住所・電話番号は実在の誰かのものではありません。だからこそスクリーンショットやデモで安全に使えます。実在の識別子が必要な場面(本人確認・税番号・ID 形式)では使えません。検証で弾かれるのが正しい挙動です。
乱数には品質がある
Math.random は高速で、配色のダミーには十分ですが、パスワード・API キー・推測されると困る値には不適切です。当サイトで認証情報を生成するツールは crypto.getRandomValues を使い、どちらを使ったかをページに明記しています。
自分で確かめる
ページを再読み込みしてください。保存していないため、前の出力は消えます。
- 1.このページで DevTools を開き、Network タブを選ぶ
- 2.フィルタを Fetch/XHR に設定したままツールを実行する
- 3.ファイルの中身を含むリクエストが 1 件も無いことを確認する(ページの読み込みとフォントだけが表示されます)
よくある質問
安全な randomness ですか?
はい。ブラウザの crypto.getRandomValues を使うため、(Math.random より)予測しにくい文字列が生成されます。
データは送信されますか?
いいえ。すべてブラウザ内で生成され、サーバーには送られません。