Menu

#297 Use of rand() in FadeEffect::pixelated_fade_core

v1.0 (example)
closed-fixed
nobody
None
5
2015-01-01
2014-06-22
No

Using rand() with modulo arithmetic may skew the uniform distribution over the short term (I think), in particular on systems with a bad rand() implementation. This may lead to a nuvie hang starting a new game (see attached picture) with the first fade-in. The attached patch attempts to address this.

This might also be related to the issue mentioned here [22:41:45]: http://log.usecode.org/nuvielog.php?log=24Mar2014

2 Attachments

Discussion

  • Yorick Hardy

    Yorick Hardy - 2014-06-22

    Hopefully attached the correct patch this time (should use NUVIE_RAND_MAX).

     
  • Yorick Hardy

    Yorick Hardy - 2014-06-23

    Apologies, the maximum randomly generated value should be fade_width-1 (and similarly for height) which is consistent with the original code.

     
  • Malignant Manor

    Malignant Manor - 2015-01-01
    • status: open --> closed-fixed
     
  • Malignant Manor

    Malignant Manor - 2015-01-01

    Eric added the patch in r1952.

     

Log in to post a comment.

MongoDB Logo MongoDB