ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
 

Package flash.crypto 


Package functions description.
Public Methods
 FunctionDefined By
  
Generates a sequence of random bytes.
flash.crypto
Function detail

generateRandomBytes

()function
public function generateRandomBytes(numberRandomBytes:uint):ByteArray

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 11, AIR 3

Generates a sequence of random bytes.

Use generateRandomBytes() to generate cryptographic keys, strong identifiers, session ids, and so on. The random sequence is generated using cryptographically strong functions provided by the operating system. If the appropriate function is not available on an individual client computer or device, then an error is thrown.

Parameters

numberRandomBytes:uint — the number random bytes to generate, between 1 and 1024.

Returns
ByteArray — a ByteArray containing the generated bytes.

Throws
Error — when the random bytes could not be generated.

Related API Elements