DeeterministicRandom types optimized.

This commit is contained in:
mlemanczyk committed 2025-12-13 16:00:28 +01:00
1 parent 1b3882addc
commit e8cca74f68
3 files changed
+9 -20

No files matched your search

@@ -14,33 +14,25 @@ internal struct DeterministicRandomGpu
{
private static long s_seedCounter;
private ulong _state;
public readonly ulong State
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return _state;
}
}
public ulong State;
public DeterministicRandomGpu()
{
_state = CreateThreadState();
State = CreateThreadState();
}
public DeterministicRandomGpu(ulong initialState)
{
_state = initialState;
State = initialState;
}
public ulong NextUInt64()
{
ulong state = _state;
ulong state = State;
state ^= state >> 12;
state ^= state << 25;
state ^= state >> 27;
_state = state;
State = state;
return state * 2685821657736338717UL;
}
@@ -55,7 +47,7 @@ internal struct DeterministicRandomGpu
public void SetState(ulong state)
{
_state = state;
State = state;
}
private static ulong CreateThreadState()