Retired

PRNG: Blum Blum Shub (retired)

Description
Loading description...
Algorithms
Logic
  • Please sign in or sign up to leave a comment.
  • Blind4Basics Avatar

    Modifications have been made, but the description lacks the informations about the rounding rules. How are we supposed to know what to do?

  • anter69 Avatar

    After fixing the issue below, I suggest to make the kata a bit harder, because this way it's very easy (basically just completing a simple function). It's just an interesting concept a little bit "wasted" this way. You could:

    • make the user write the whole class from scratch
    • define M at initialization
    • try to find another "twist"

    Oh, and definitely, it needs more tests!

  • dcsmith Avatar

    You gave the solution in your example test cases!!! D:

    You also might want to specify how exactly we are to normalize the value to be within [0, 1]. Incidentally, your solution will only ever return 1 of 100 unique values: [0.0, 0.01, 0.02, 0.03, ... , 0.98, 0.99] -- not quite how the PRNG should behave. May be better to just divide by M. Of course, you may have done it that way to ease testing, which is fine. But either way, it should be stated clearly in the description.

    • anter69 Avatar

      Test case issue fixed.

      Otherwise I totally agree with the above, the RNG is not correct this way, so think of a better solution, like in your LCG kata (expect value / M rounded to some digits)