I just want a sanity check here. I was trying to display a random integer seed (0 -> max int32) to players using a converted hex value and noticed that my least significant digits were always coming back as 0’s. Looking at UKismetMathLibrary::RandomInteger leads to FMath::RandHelper and this inline:
static FORCEINLINE int32 RandHelper(int32 A)
{
// RAND_MAX+1 give interval 0..A) with even distribution.
return A>0 ? TruncToInt(Rand()/(float)((uint32)RAND_MAX+1) * A) : 0;
}
Is it me, or is this dropping a lot of precision for large integers? Any particular reason for the float instead of double conversion here?