9#include "CoreMinimal.h"
11#include "SquirrelRNG.generated.h"
17UCLASS(BlueprintType, Blueprintable)
18class YASIUMATH_API USquirrel13_RNG : public UObject {
24 USquirrel13_RNG(
unsigned int seed )
25 : m_seed(seed), init_seed(seed) {};
27 USquirrel13_RNG(
int position,
unsigned int seed )
28 : m_position(position), m_seed(seed), init_position(position), init_seed(seed) {};
30 USquirrel13_RNG(
int position,
unsigned int seed,
unsigned int variant )
31 : m_position(position), m_seed(seed),
m_variant(variant), init_position(position), init_seed(seed) {};
38 unsigned int m_seed{1};
45 unsigned
int init_position = 0;
55 UFUNCTION(BlueprintCallable, Category=
"RNG")
56 void InitBP(
int seed,
int position = 0 );
59 uint32_t get_current_random() const;
62 uint32_t get_next_random();
65 UFUNCTION(BlueprintCallable, Category=
"RNG")
69 UFUNCTION(BlueprintCallable, Category=
"RNG")
75 UFUNCTION(BlueprintCallable, Category=
"RNG")
79 UFUNCTION(BlueprintCallable, Category=
"RNG")
83 UFUNCTION(BlueprintCallable, Category=
"RNG")
90 UFUNCTION(BlueprintCallable, Category=
"RNG")
94 UFUNCTION(BlueprintCallable, Category=
"RNG")
100 UFUNCTION(BlueprintCallable, Category=
"RNG")
104 UFUNCTION(BlueprintCallable, Category=
"RNG")
108 static uint32_t
RNG_0(
int position,
unsigned int seed );
111 static uint32_t
RNG_1(
int position,
unsigned int seed );
114 static uint32_t
RNG_2(
int position,
unsigned int seed );
117 static uint32_t
RNG_3(
int position,
unsigned int seed );
120 static uint32_t
RNG_4(
int position,
unsigned int seed );
123 static uint32_t
RNG_5(
int position,
unsigned int seed );
void ResetSeedPos()
Reset to internal initial values.
void SetNoiseVariant(int newVariant=0)
Internal noise variants (it is not initialized), default=0, max=5 Invalid variants will use default n...
double GetCurrentDouble() const
Return last random double in range <0, 1>.
static uint32_t RNG_3(int position, unsigned int seed)
Noise variant.
static uint32_t RNG_0(int position, unsigned int seed)
Noise variant.
static uint32_t RNG_5(int position, unsigned int seed)
Noise variant.
void OffsetPosition(int offset=1)
Offset current position, can be positive and negative.
void SetSeed(int new_seed)
Set seed noise seed.
int m_variant
variable related to selected noise variant
Definition SquirrelRNG.h:42
static uint32_t RNG_1(int position, unsigned int seed)
Noise variant.
static uint32_t RNG_4(int position, unsigned int seed)
Noise variant.
static uint32_t RNG_2(int position, unsigned int seed)
Noise variant.
double GetNextDouble()
Move position by 1 and return double in range <0, 1>.
int GetNextInt(int min, int max)
Move position by 1 and return random value as integer in range <min, max>.
int GetCurrentInt(int min, int max) const
Return random value scaled to integer range <min, max> at current position.
void SetPosition(int new_position)
Set generator position.
void InitBP(int seed, int position=0)
Modify internal values to custom.
virtual void Serialize(FArchive &Ar) override
Serialization of RNG Object.