26 static uint64 GenerateRandomId();
35 UFUNCTION(BlueprintCallable)
36 static int32 GenerateRandomSeed();
39 UFUNCTION(BlueprintCallable)
43 UFUNCTION(BlueprintCallable)
44 void Seed(int32 InSeed)
55 UFUNCTION(BlueprintCallable)
56 float GetUniformFloat()
58 return std::uniform_real_distribution<float>()(Engine);
61 UFUNCTION(BlueprintCallable)
62 float GetUniformFloatInRange(
float Minimum,
float Maximum)
64 return std::uniform_real_distribution<float>(Minimum, Maximum)(Engine);
67 UFUNCTION(BlueprintCallable)
68 int32 GetUniformIntInRange(int32 Minimum, int32 Maximum)
70 return std::uniform_int_distribution<int32>(Minimum, Maximum)(Engine);
73 UFUNCTION(BlueprintCallable)
76 return (GetUniformIntInRange(0, 1) == 1);
85 UFUNCTION(BlueprintCallable)
86 bool GetBernoulliDistribution(
float P)
88 return std::bernoulli_distribution(P)(Engine);
91 UFUNCTION(BlueprintCallable)
92 int32 GetBinomialDistribution(int32 T,
float P)
94 return std::binomial_distribution<int32>(T, P)(Engine);
97 UFUNCTION(BlueprintCallable)
98 int32 GetPoissonDistribution(
float Mean)
100 return std::poisson_distribution<int32>(Mean)(Engine);
103 UFUNCTION(BlueprintCallable)
104 float GetExponentialDistribution(
float Lambda)
106 return std::exponential_distribution<float>(Lambda)(Engine);
109 UFUNCTION(BlueprintCallable)
110 float GetNormalDistribution(
float Mean,
float StandardDeviation)
112 return std::normal_distribution<float>(Mean, StandardDeviation)(Engine);
121 UFUNCTION(BlueprintCallable)
122 bool GetBoolWithWeight(
float Weight)
124 return (Weight >= GetUniformFloat());
127 UFUNCTION(BlueprintCallable)
128 int32 GetIntWithWeight(const TArray<
float> &Weights)
130 return std::discrete_distribution<int32>(
132 Weights.GetData() + Weights.Num())(Engine);
141 template <
typename T>
144 check(Array.Num() > 0);
145 return Array[GetUniformIntInRange(0, Array.Num() - 1)];
148 template <
typename T>
151 std::shuffle(Array.GetData(), Array.GetData() + Array.Num(), Engine);