Table of Contents

Struct IntRange

Namespace
Artemis.Core
Assembly
Artemis.Core.dll

Represents a range between two signed integers

public readonly struct IntRange
Inherited Members

Constructors

IntRange(int, int)

Creates a new instance of the IntRange class

[JsonConstructor]
public IntRange(int start, int end)

Parameters

start int

The start value of the range

end int

The end value of the range

Properties

End

Gets the end value of the range

public int End { get; }

Property Value

int

Start

Gets the start value of the range

public int Start { get; }

Property Value

int

Methods

GetRandomValue(bool)

Returns a pseudo-random value between Start and End

public int GetRandomValue(bool inclusive = true)

Parameters

inclusive bool

Whether the value may be equal to Start

Returns

int

The pseudo-random value

IsInRange(int, bool)

Determines whether the given value is in this range

public bool IsInRange(int value, bool inclusive = true)

Parameters

value int

The value to check

inclusive bool

Whether the value may be equal to Start or End

Defaults to true

Returns

bool