CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.34k stars 4.14k forks source link

Lab computers displaying the same research log on each hacks #40577

Closed DillonSimeone closed 4 years ago

DillonSimeone commented 4 years ago

Describe the bug

When you're hacking lab computers to read the research logs, you'll get the same log on each hacks.

Steps To Reproduce

  1. Break into a lab.
  2. Find a working computer in lab.
  3. Hack the research log over and over, noting that you're getting the same log each time.

Expected behavior

Different logs are shown at random.

I know about the other logs because that was how it used to be a long time ago, with your odd of failure going up the more you hacked to get at the deeper logs.

Screenshots

image

Versions and configuration

Additional context

Qrox commented 4 years ago

For some reason the random engine used in snippet_library::random_from_category returns the same value for different seed values.

Edit: seems that uniform_int_distribution produces significant bias when the random engine is cata_default_random_engine aka minstd_rand0 and the seed is small (see this stackoverflow question). We should either revert snippet_library::random_from_category to use std::mt19937 again or use std::mt19937 for cata_default_random_engine instead. @jbytheway What's your opinion?