< Summary

Information
Class: Safarimacik.Model.RandomGenerator
Assembly: Safarimacik
File(s): /builds/szofttech-ab-2025/group-03/safarimacik/model/RandomGenerator.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 36
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
.ctor()100%11100%
Dispose()100%11100%
Rand(...)100%11100%
RandI(...)100%11100%

File(s)

/builds/szofttech-ab-2025/group-03/safarimacik/model/RandomGenerator.cs

#LineLine coverage
 1using Godot;
 2
 3
 4namespace Safarimacik.Model;
 5
 6
 7/// <summary>
 8/// Represents a random number generator realizing IRandomGenerator.
 9/// </summary>
 10public class RandomGenerator : IRandomGenerator {
 11  private readonly RandomNumberGenerator _random;
 12
 113  public RandomGenerator() {
 114    _random = new RandomNumberGenerator();
 115    _random.Randomize();
 116  }
 17
 118  public void Dispose() {
 119    _random.Dispose();
 120    GC.SuppressFinalize(this);
 121  }
 22
 23  /// <summary>
 24  /// Returns a pseudo-random float value between minValue and maxValue (inclusive)
 25  /// </summary>
 126  public float Rand(float minValue, float maxValue) {
 127    return _random.RandfRange(minValue, maxValue);
 128  }
 29
 30  /// <summary>
 31  /// Returns a pseudo-random int value between minValue and maxValue (inclusive)
 32  /// </summary>
 133  public int RandI(int minValue, int maxValue) {
 134    return _random.RandiRange(minValue, maxValue);
 135  }
 36}