File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1884,7 +1884,7 @@ protected virtual bool OnFrame()
18841884 if ( ! nextFrame )
18851885 return false ;
18861886
1887- RNG . UpdateSeed ( ( ulong ) FrameCounter ) ;
1887+ RNG . UpdateSeed ( ( ushort ) FrameCounter ) ;
18881888
18891889 if ( Player != null )
18901890 {
Original file line number Diff line number Diff line change @@ -35,14 +35,48 @@ public ushort NextValue()
3535 return seed ;
3636 }
3737
38+ public ushort NextValue ( ushort count )
39+ {
40+ return NextValue ( 0 , count ) ;
41+ }
42+
3843 public ushort NextValue ( ushort start , ushort end )
3944 {
4045 return ( ushort ) ( start + NextValue ( ) % ( end - start ) ) ; // This one will change the distribution by using modulus, but original game does the same thing.
4146 }
4247
43- public ushort NextValue ( ushort count )
48+ public uint NextInt ( )
4449 {
45- return NextValue ( 0 , count ) ;
50+ ushort hi = NextValue ( ) ;
51+ ushort lo = NextValue ( ) ;
52+ return ( uint ) ( hi << 16 ) | lo ;
53+ }
54+
55+ public uint NextInt ( uint count )
56+ {
57+ return NextInt ( 0 , count ) ;
58+ }
59+
60+ public uint NextInt ( uint start , uint end )
61+ {
62+ return start + NextInt ( ) % ( end - start ) ;
63+ }
64+
65+ public ulong NextLong ( )
66+ {
67+ uint hi = NextInt ( ) ;
68+ uint lo = NextInt ( ) ;
69+ return ( ulong ) ( hi << 32 ) | lo ;
70+ }
71+
72+ public ulong NextLong ( ulong count )
73+ {
74+ return NextLong ( 0 , count ) ;
75+ }
76+
77+ public ulong NextLong ( ulong start , ulong end )
78+ {
79+ return start + NextLong ( ) % ( end - start ) ;
4680 }
4781
4882 public float NextFloat ( )
You can’t perform that action at this time.
0 commit comments