Problems with Spin Box Values & Random Int in Range node

Spin Box
If I try to set the spin box value to 2147483647 (the maximum value of an int32), the slider automatically sets its value to 2147483648. This is also true for its minimum and maximum values. Also true with other numbers like 2147483600 for example.

Random Int in Range
Setting both the minimum and maximum values to -2147483648 and 2147483647 (the allowed range for an int32) only returns the minimum value as a random int, instead of a value within the specified range.

I tested both of these in a completely new project and the issue persists. So the question is, why is this happening?

Someone with an idea?

Hi Tsybe, firstly, the min should be -2147483647 - trying to set an int32 to -2147483648 causes an unary error in c++.

The code for the RandonIntInRange is:

FORCEINLINE int32 RandRange(const int32 SeqIndex, const int32 InMin, const int32 InMax)
	{
		const int32 Range = (InMax - InMin) + 1;
		return InMin + RandHelper(SeqIndex, Range);
	}

I’m assuming the SpinBox is similar - it’s trying to calculate a Range of those 32bit numbers in a 32bit number - and a range of -2147483647 and 2147483647 is larger than 32bits…

This is optimal code as almost always your range will be a lot less than that - if you’re wanting that range - use a RandomInt64InRange instead…