Core Function BinaryRandom

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> BinaryRandom( <binary-array>, <seed> ) </pre> === Description === Randomize all bytes in a binary variable. === Parameters === ==== binary-array ==== The binary varia...")
 
Line 1: Line 1:
 
<pre>
 
<pre>
BinaryRandom( <binary-array>, <seed> )
+
BinaryRandom( <binary-array>, <seed> )
 
</pre>
 
</pre>
  

Revision as of 02:26, 27 July 2014

BinaryRandom( <binary-array>, <seed> )

Contents

Description

Randomize all bytes in a binary variable.

Parameters

binary-array

The binary variable to use.

seed

Optional; The seed to use when generating the random numbers

Return Value

Success: Returns true.

Failure: Returns false.

Remarks

None.

Example

// Convert a string to binary
my $bin = Pack("A*", "Hello world!");
// Print it
say BinaryExpand($bin);
// Blank line
say;
// Randomize the binary
BinaryRandom($bin);
// Print it
say BinaryExpand($bin);
// Prints:
// 48 65 6C 6C 6F 20 77 6F 72 6C 64 21 -- -- -- -- Hello world!
//
// 4E 49 E3 26 CC B5 98 BC 0A 2C 62 7A -- -- -- -- NIã&̵...,bz
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox