Skip to content
Astra
ProductDocumentationDownloadPricingCommunity
Sign inGet Astra

Explore Astra

Explore Astra

HomeProductPricingDocumentationDownloadRelease notesSystem status
Sign inDiscord
Roblox
IntroductionQuick start
Keys & licensingYour workspaceTroubleshooting
API reference
Closures
Debug
Environment
Metatables
Scheduler
Instances
Cache
Scripts
Signals
Filesystem
Input
Console
Cryptography
base64decodebase64encodecrypt.decryptcrypt.encryptcrypt.generatebytescrypt.generatekeycrypt.hashcrypt.hmaccrypt.randomlz4compresslz4decompress
JSON
Regex
System
Scene files
Drawing
UI library
Renderer
Requests
Network
API referenceCryptography

crypt.random

Generates random bytes.

Syntax

Signature
crypt.random(Count: number) -> string

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
CountnumberNumber of random bytes.

Returns

TypeDescription
stringRaw random bytes.

Notes

Count must be an integer from zero through 16 MiB.

Example

Luau
local Result = crypt.random(16)
print(Result)

Related functions

base64encodebase64decodelz4compresslz4decompress
Previouscrypt.hmacCryptographyNextlz4compressCryptography

On this page

SyntaxAliasesParametersReturnsNotesExampleRelated functions
Astra

A complete Luau workspace.
Your editor, scripts, and accounts in one place.

Get Astra

WindowsmacOSFree keyPricingRedeemDashboard

Product

EditorScript HubAccountsFeaturesComparison

Community

DiscordSystem statusSupport

Learn

DocumentationRelease notes

Developers

API referenceLuau LSPBenchmarks

Legal

TermsPrivacyCookiesRefund policy
System statusSupportTermsPrivacyCookies

© 2026 Astra. All rights reserved.