> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# crypt.random

> random byte generator で raw random bytes を生成し、Lua string として返します。

<div className="real-function-page">
  ```lua theme={null}
  crypt.random(size: number): string
  ```

  ## 引数

  <ParamField path={"size"} type={"number"} required>
    割り当て前に integer conversion を通る数値。0 以下の値は argument error を発生させます。
  </ParamField>

  ## 戻り値

  <ResponseField name={"bytes"} type={"string"}>
    Lua string として返される raw generated bytes。返される string の長さは割り当てられたバイト数と一致します。
  </ResponseField>

  ## 例

  raw bytes を生成し、返された Lua string の長さを表示します。

  ```lua theme={null}
  local bytes = crypt.random(16)

  print(bytes)
  print(#bytes)
  ```
</div>
