Skip to content

Instantly share code, notes, and snippets.

View MaksimSazanovich's full-sized avatar
🥞
Unity

Unity_one_love MaksimSazanovich

🥞
Unity
View GitHub Profile
@MaksimSazanovich
MaksimSazanovich / HierarchyRandom.cs
Last active June 28, 2024 15:07
My modified version of Random class in C# which returns smaller values more often than bigger ones.
using UnityEngine;
namespace Unity_one_love
{
public static class HierarchyRandom
{
public static int Range(int minValue, int maxValue)
{
int firstSum = maxValue - minValue + 1;
int sum = firstSum * (firstSum + 1) / 2 + 1;