mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 15:16:33 -08:00
14 lines
459 B
C#
14 lines
459 B
C#
namespace Cube;
|
|
|
|
internal static class RandomExtensions
|
|
{
|
|
internal static (float, float, float) NextLocation(this IRandom random, (int, int, int) bias)
|
|
=> (random.NextCoordinate(bias.Item1), random.NextCoordinate(bias.Item2), random.NextCoordinate(bias.Item3));
|
|
|
|
private static float NextCoordinate(this IRandom random, int bias)
|
|
{
|
|
var value = random.Next(3);
|
|
if (value == 0) { value = bias; }
|
|
return value;
|
|
}
|
|
} |