> ## 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.generatebytes

> random byte generator でランダムバイトを生成し、Base64-encoded として Lua string で返します。

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

  ## 引数

  <ParamField path={"size"} type={"number"} required>
    割り当て前に integer conversion を通る数値。0 以下の値は 1 に変更されます。
  </ParamField>

  ## 戻り値

  <ResponseField name={"encoded"} type={"string"}>
    生成された raw bytes の Base64 encoding。返される string の長さは要求したバイト数ではありません。
  </ResponseField>

  ## 例

  raw bytes が必要な場合は、バイトを生成して Base64 結果をデコードします。

  ```lua theme={null}
  local encoded = crypt.generatebytes(16)
  local raw = base64_decode(encoded)

  print(encoded)
  print(#encoded)
  print(#raw)
  ```
</div>
