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

> Tao raw random bytes bang random byte generator va tra ve chung duoi dang Lua string.

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

  ## Đối số

  <ParamField path={"size"} type={"number"} required>
    So duoc dua qua integer conversion truoc khi allocation. Cac gia tri nho hon hoac bang 0 gay ra argument error.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"bytes"} type={"string"}>
    Raw generated bytes duoc tra ve duoi dang Lua string. Do dai string duoc tra ve khop voi so byte da allocation.
  </ResponseField>

  ## Ví dụ

  Tao raw bytes va in do dai Lua string duoc tra ve.

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

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