< Summary

Information
Class: Rudim.Common.Random
Assembly: Rudim
File(s): /home/runner/work/rudim/rudim/Rudim/Common/Random.cs
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 38
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
NextULong()100%11100%
NextInt()100%11100%
_RESET_SEED()100%11100%

File(s)

/home/runner/work/rudim/rudim/Rudim/Common/Random.cs

#LineLine coverage
 1namespace Rudim.Common
 2{
 3    /*
 4     * This class is to generate fast random numbers using
 5     * https://en.wikipedia.org/wiki/Xorshift
 6     */
 7    public static class Random
 8    {
 9        // Arbitrary starting seed
 110        private static ulong _ulongState = 1804289383;
 111        private static int _intState = 1804289383;
 12
 13        public static ulong NextULong()
 14        {
 133815            ulong randomNumber = _ulongState;
 133816            randomNumber ^= randomNumber << 13;
 133817            randomNumber ^= randomNumber >> 7;
 133818            randomNumber ^= randomNumber << 17;
 133819            return _ulongState = randomNumber;
 20        }
 21
 22        public static int NextInt()
 23        {
 50024            int randomNumber = _intState;
 50025            randomNumber ^= randomNumber << 13;
 50026            randomNumber ^= randomNumber >> 17;
 50027            randomNumber ^= randomNumber << 5;
 50028            return _intState = randomNumber;
 29        }
 30
 31        // DO NOT USE FOR PROJECT - ONLY USED IN RandomTest.cs for determinism
 32        public static void _RESET_SEED()
 33        {
 234            _ulongState = 1804289383;
 235            _intState = 1804289383;
 236        }
 37    }
 38}