Garry's Mod Wiki

Revision Difference

math.randomseed#565580

<function name="randomseed" parent="math" type="libraryfunc"> <description> Seeds the random number generator. The same seed will guarantee the same sequence of numbers each time with <page>math.random</page>. For shared random values across predicted realms, use <page>util.SharedRandom</page>. ⤶ <warning>Incorrect usage of this function will affect `all` random numbers in the game.</warning>⤶ ⤶ <warning>Usage of this function affects **ALL** random numbers in the game. This means that improper use (such as setting the seed to a static value that doesn't change with time) can negatively affect other addons or the base game.⤶ It is a good idea to set the seed back to at least something like <page>Global.SysTime</page> in those cases.⤶ </warning>⤶ </description> <realm>Shared and Menu</realm> <args> <arg name="seed" type="number">The new seed</arg> </args> </function>