Stardew Valley
0 of 0

File information

Last updated

Original upload

Created by

Ashley

Uploaded by

bambimenot

Virus scan

Safe to use

Tags for this mod

About this mod

Fixes the broken random number generation in Stardew Valley. Addresses the broken slot machine mini game and many other similar problems.

Permissions and credits
Fix Dice overrides pseudo-random number generation in the game's code, forcing it to use more mathematically correct seed inputs. This is done by overriding the seed given to new System.Random instances with outputs from a central System.Random instance.

In the source code, the game will try to "seed" the random number generator with bad input, which will produce demonstrably non-random outputs. For instance, the slot machine mini game in the casino re-seeds every lever pull with "times played slots + days played + unique id for this game." The result of the expression is the same as the value used in the previous lever pull, plus one. Because of this, many consecutive games will produce a predictable win/loss pattern (LLLLLLLWLWLW... repeating) as seen here: https://www.youtube.com/watch?v=Z3DrzHecmk0

The specific length and pattern produced by the slot machine is dependent on several factors:
  • How many times you've played the slot machine
  • How many days you've played on the save file
  • The unique id generated when you created the save file
  • Your daily luck (as indicated by the fortune teller + luck modifying foods)
  • Your luck level (the invisible sixth skill which is leveled silently every time you perform a random action)

This bug affects many different parts of the game. The vendor in the sewer is seeded by "days played + (unique id / 2)", which again produces the same seed as the day before plus one. Breaking rocks is seeded by "x * 1000 + y + days played + unique id / 2" with no regard for order of operations. Breaking a rock directly above or below another rock will use the same seed plus or minus one, which again produces non-random values. Crop harvests. Random events. Mine shaft slime floors. This bug affects many, if not all, of the platforms that Stardew Valley is released on.

This mod fixes the problem, which greatly improves the experience of the game. I hope to see a fix rolled out for all versions of the game some day.

Fix Dice is a one line fix, so it should be compatible with every version of the game and have very few conflicts with other mods.

Version 1.1.2 fixes a bug in selecting an NPC for events like Feast of the Winter Star, and the tool charge-up sound effect. May potentially introduce other bugs and break backwards compatibility. Version 1.0.1 is available for download if any issues arise.