using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GeckVolantMarin-LuckBasedRNG")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GeckVolantMarin-LuckBasedRNG")]
[assembly: AssemblyTitle("GeckVolantMarin-LuckBasedRNG")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace GeckVolantMarin
{
public class RNG
{
private static Random rng = new Random();
public static void setSeed(int seed)
{
rng = new Random(seed);
}
public static void reSeed()
{
rng = new Random();
}
public static double getRandomNumber_InRange(double min, double max, double luck = 0.0)
{
return (max - min) * Math.Pow(rng.NextDouble(), Math.Pow(Math.E, luck)) + min;
}
public static bool getRandomBool_FromFraction(double numerator, double denominator = 1.0, double luck = 0.0)
{
return getRandomNumber_InRange(0.0, denominator, 0.0 - luck) <= numerator;
}
public static double getTotalWeight_FromArray(double[] weights)
{
double num = 0.0;
for (int i = 0; i < weights.Count(); i++)
{
num += weights[i];
}
return num;
}
public static void generateNewWeights(ref double[] weights, double luck = 0.0)
{
double totalWeight_FromArray = getTotalWeight_FromArray(weights);
double num = 0.0;
for (int i = 0; i < weights.Count(); i++)
{
weights[i] *= Math.Pow(Math.E, (0.0 - luck) * (weights[i] / totalWeight_FromArray));
num += weights[i];
}
for (int j = 0; j < weights.Count(); j++)
{
weights[j] /= num;
}
}
public static Type getRandomThings_FromArray<Type>(Type[] array, double[] weights, double luck = 0.0)
{
generateNewWeights(ref weights, luck);
double totalWeight_FromArray = getTotalWeight_FromArray(weights);
double randomNumber_InRange = getRandomNumber_InRange(0.0, totalWeight_FromArray);
double num = 0.0;
for (int i = 0; i < weights.Count(); i++)
{
num += weights[i];
if (randomNumber_InRange <= num)
{
return array[i];
}
}
return array[weights.Count() - 1];
}
}
}