mirror of https://github.com/stella-emu/stella.git
Make Random::next() const, since logically it should be.
The fact that it updates an internal variable is an implementation detail that shouldn't be exposed outside the class.
This commit is contained in:
parent
97f1220e11
commit
02b1f7e078
|
@ -52,7 +52,7 @@ class Random
|
|||
|
||||
@return A random number
|
||||
*/
|
||||
uInt32 next()
|
||||
uInt32 next() const
|
||||
{
|
||||
return (myValue = (myValue * 2416 + 374441) % 1771875);
|
||||
}
|
||||
|
@ -62,7 +62,11 @@ class Random
|
|||
const OSystem& myOSystem;
|
||||
|
||||
// Indicates the next random number
|
||||
uInt32 myValue;
|
||||
// We make this mutable, since it's not immediately obvious that
|
||||
// calling next() should change internal state (ie, the *logical*
|
||||
// state of the object shouldn't change just by asking for another
|
||||
// random number)
|
||||
mutable uInt32 myValue;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -182,7 +182,7 @@ class System : public Serializable
|
|||
@param hmask The bits which should always be driven high
|
||||
@return The data bus state
|
||||
*/
|
||||
uInt8 getDataBusState(uInt8 zmask, uInt8 hmask = 0x00)
|
||||
uInt8 getDataBusState(uInt8 zmask, uInt8 hmask = 0x00) const
|
||||
{
|
||||
// For the pins that are floating, randomly decide which are high or low
|
||||
// Otherwise, they're specifically driven high
|
||||
|
|
Loading…
Reference in New Issue