A module for generating secure random numbers and strings in Garry's Mod
- size (number) - A whole number representing the amount of bytes you want returned
Generates size
bytes and returns them as a string.
- min (number, optional, default 0) - The minimum value to generate
- max (number, optional, default 1) - The maximum value to generate
Generates a number between min
and max
and returns it.
require( "securerandom" )
print( util.Base64Encode( random.Bytes( 16 ) ) )
require( "securerandom" )
print( random.Number() )
require( "securerandom" )
print( random.Number( 20.5 ) )
require( "securerandom" )
print( random.Number( 5, 10.5 ) )
require( "securerandom" )
print( random.WholeNumber() )
require( "securerandom" )
print( random.WholeNumber( 20 ) )
require( "securerandom" )
print( random.Number( 5, 10 ) )
require( "securerandom" )
for i = 1, 10 do
random.RandomSeed( 1234 )
print( random.Number( 5, 10 ) )
end