• MangoCats@feddit.it
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 hour ago

        4 is used for non-deterministic delay - - - is Random.nextInt() also cryptographically secure?

    • ferric_carcinization@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 hours ago

      I feel like an idiot. Also, in the “Good” example, no underflow occurs. i goes from 0 to -10, and x is assigned to -i every loop.

      It might still be possible to optimize away the random number example, if the random function were made a magic language item, but it would not be even remotely close to being worth the effort.

      • MangoCats@feddit.it
        link
        fedilink
        English
        arrow-up
        1
        ·
        60 minutes ago

        The question the optimizer can’t really answer is: will Random.nextInt() ever return 10? If that’s a 64 bit integer it could be a LOOOOOONG time before 10 ever shows up.