# Random（ロブロックス データ型）

> 乱数（ランダムな数）を作るためのデータ型です。Random.new()で作り、NextIntegerなどで数を取り出します。

- URL：https://roblox.minecraft-okinawa.com/reference/datatypes/Random/
- 公式：https://create.roblox.com/docs/reference/engine/datatypes/Random

## コンストラクター

- `Random.new(seed: number)`：Returns a new pseudorandom generator using an optional seed.

## メソッド

- `Random:NextInteger(min: number, max: number): number`：指定した範囲のランダムな整数を返します。
- `Random:NextNumber(): number`：指定した範囲のランダムな小数を返します。
- `Random:NextNumber(min: number, max: number): number`：指定した範囲のランダムな小数を返します。
- `Random:Shuffle(tb: table): ()`：Uniformly shuffles a table in-place.
- `Random:NextUnitVector(): Vector3`：Returns a unit vector with a pseudorandom direction.
- `Random:Clone(): Random`：Returns a new Random object with the same state as the original.

英語の説明とメンバー一覧：Roblox Creator Documentation（CC BY 4.0）。日本語の解説はこのサイト独自のものです。

執筆：鈴木孝昌（現役プロジェクトマネージャー／プログラミング講師）／運営：沖縄マイクラ部 プログラミングスクール「クロスウェーブ」（https://minecraft-okinawa.com/）