mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-23 22:48:07 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
32 lines
583 B
C#
32 lines
583 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Sandbox;
|
|
|
|
/// <summary>
|
|
/// Hidden random class. This is secretly used by Game.Random, but being here
|
|
/// allows all of our system functions to use the same Random instance.
|
|
/// </summary>
|
|
static class SandboxSystem
|
|
{
|
|
[ThreadStatic]
|
|
static Random _random;
|
|
|
|
internal static Random Random
|
|
{
|
|
get
|
|
{
|
|
_random ??= new Random();
|
|
return _random;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the seed for these static classes
|
|
/// </summary>
|
|
public static void SetRandomSeed( int seed )
|
|
{
|
|
_random = new Random( seed );
|
|
}
|
|
}
|