some rng fixes
parent
d1983bf168
commit
231575757e
|
@ -117,8 +117,7 @@ namespace MoonTools.ECS
|
|||
|
||||
public int Next(int n)
|
||||
{
|
||||
var next = NextInternal();
|
||||
return (int) (((double) next) * n / uint.MaxValue);
|
||||
return (int) (((double) Next()) * n / int.MaxValue);
|
||||
}
|
||||
|
||||
public int Next(int min, int max)
|
||||
|
@ -131,7 +130,7 @@ namespace MoonTools.ECS
|
|||
public long NextInt64()
|
||||
{
|
||||
long next = NextInternal();
|
||||
next <<= 32;
|
||||
next <<= 31;
|
||||
next |= NextInternal();
|
||||
return next;
|
||||
}
|
||||
|
@ -139,7 +138,7 @@ namespace MoonTools.ECS
|
|||
public long NextInt64(long n)
|
||||
{
|
||||
var next = NextInt64();
|
||||
return (long) (((double) next) * n / ulong.MaxValue);
|
||||
return (long) (((double) next) * n / long.MaxValue);
|
||||
}
|
||||
|
||||
public long NextInt64(long min, long max)
|
||||
|
|
Loading…
Reference in New Issue