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

> Generates raw random bytes with random byte generator and returns them as a Lua string.

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

  ## Arguments

  <ParamField path={"size"} type={"number"} required>
    Number converted to an integer before allocation. Values less than or equal to 0 raise an argument error.
  </ParamField>

  ## Returns

  <ResponseField name={"bytes"} type={"string"}>
    Raw generated bytes returned as a Lua string. The returned string length matches the allocated byte count.
  </ResponseField>

  ## Example

  Generate raw bytes and print the returned Lua string length.

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

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