I don’t know what am I doing wrong here. The comment says:
@anonymous_user_b2e972a1 A random number >= Min and <= Max
FRandomStream test;
auto random = test.RandRange(1, 5);
UE_LOG(LogTemp, Warning, TEXT("%d"), random);
The console will only output this:
LogTemp:Warning: 1
Hey Klawd3-
Rather than using FRandomStream to get a random number you can use FMath::FRandRange(A, B);. This will return a random number in the range of A through B-1 (so using (1, 6) will return a number in the range of 1-5)).
Cheers
Hi ,
I had already resorted to use FMath library, and it’s working fine.
Could you tell me if UE libraries contain a Fisher-Yates algorithm implementation for true rng? Or do I have to implement one myself?
Thanks.
It appears that rand() is calling the STL version rather than its own implementation. If you want something along the lines of the Fisher-Yates algorithm you will have to implement it on your end.
Hi , it’s still not clear to me if I should, or not, use std:: library functions. I indirectly learned to only use what UE offers, on the c++ side. If I can infact use them without causing any compatibility/packaging problems, the standard library does infact have a native fisher-yates implementation for rng.