util.SharedRandom
Description
Generates a random float value that should be the same on client and server.
This function is best used in a predicted hook.
This uses a different method of obtaining random numbers and is unaffected by math.randomseed. Instead it uses an internal seed that is based on the player's current predicted command and is fixed to a value of -1 outside of prediction.
Arguments
Returns
Example
Example usage of the function. Generates some random values.
Output: 15.979786317786
15.979786317786
15.979786317786
24.08124470342
78.480193614252
Example
A demonstration of how this function interacts with prediction.
Output: Predicted
1.4230553998719
1.4230553998719
Unpredicted
43.928178187426
---
Predicted
46.720645319075
46.720645319075
Unpredicted
43.928178187426
---
Predicted
99.127414868738
99.127414868738
Unpredicted
43.928178187426
Garry's Mod
Rust
Steamworks
Wiki Help