util.SharedRandom

From Garry's Mod
Jump to: navigation, search
 util.SharedRandom( )

Contents

Description

Generates a random float value that should be the same on client and server.

NOTE This function is best used in a Predicted Hook

Arguments

string uniqueName

The seed for the random value

Arguments

number min

The minimum value of the random range

Arguments

number max

The maximum value of the random range

Arguments

number additionalSeed=0

The additional seed

Returns

number

The random float value

Examples

Example

Example usage of the function. Generates some random values.

print( util.SharedRandom( "23", 0, 100 ) )
print( util.SharedRandom( "23", 0, 100 ) )
print( util.SharedRandom( "23", 0, 100, 0 ) )
print( util.SharedRandom( "23", 0, 100, 1337 ) )
print( util.SharedRandom( "lol", 0, 100, 1337 ) )

Output:

15.979786317786
15.979786317786
15.979786317786
24.08124470342
78.480193614252
Personal tools
Navigation