Garry's Mod Wiki

Revision Difference

util.SharedRandom#512293

<function name="SharedRandom" parent="util" type="libraryfunc">⤶ <description>⤶ Generates a random float value that should be the same on client and server.⤶ ⤶ <note>This function is best used in a</note>⤶ </description>⤶ <realm>Shared</realm>⤶ <args>⤶ <arg name="uniqueName" type="string">The seed for the random value</arg>⤶ <arg name="min" type="number">The minimum value of the random range</arg>⤶ <arg name="max" type="number">The maximum value of the random range</arg>⤶ <arg name="additionalSeed" type="number" default="0">The additional seed</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="number">The random float value</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Example usage of the function. Generates some random values.</description>⤶ <code>⤶ 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 ) )⤶ </code>⤶ <output>⤶ ⤶ ```⤶ 15.979786317786⤶ 15.979786317786⤶ 15.979786317786⤶ 24.08124470342⤶ 78.480193614252⤶ ```⤶ ⤶ </output>⤶ ⤶ </example>