Merged
Conversation
taiseiue
approved these changes
Feb 21, 2026
| const max = 999999; | ||
| return Math.floor(Math.random() * (max - min + 1) + min).toString(); | ||
| return Math.floor( | ||
| (crypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)) * (max - min + 1) + min, |
Contributor
There was a problem hiding this comment.
[メモ] 0.0 ≤ x < 1.0の数字を生成している
Contributor
Author
|
:dmdm: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
関連 Pull Request / Issue
問題点 / やりたいこと / 解決したいこと / 背景 など
部屋を割り出すときに、QRコード以外の方法が必要だったので6桁の数字を導入することにした。
この6桁の番号から部屋番号を割り出せるようにしたい。
期待すること(状態や動作など)
やったこと
Snowflake ←→ 6桁の番号 の対応を KV に10分間だけ保持するようにした。
この10分という数字は Durable Object が消える時間と同じにしている。
重複が起きた場合はリトライして新しい番号を生成する。
確認手順
ここに確認手順を書きましょう