in reply to Re^3: New software TRNG
in thread New software TRNG

From repeated experiment I have found out that if I put "use bignum;" before the subroutine, it breaks it but not if I put it after the subroutine.

The interaction is that bignum or one of the modules that bignum uses slows down the central until-loop so that it is many times longer than eight microseconds. This breaks it because the subroutine is supposed to measure the number of central until-loop cycles in eight microseconds. I think that bignum slows down the maths involved.

Replies are listed 'Best First'.
Re^5: New software TRNG
by GrandFather (Saint) on Jan 30, 2014 at 02:54 UTC

    That make sense and is much what I suspected. Leaving aside the question of what that says about the robustness of your TRNG, a better solution to the problem is to ensure bignum is "off" in your sub:

    sub TRNGrand { no bignum; ... }
    If the code changes take longer than the time saved, it's fast enough already.
      Ahhhh! Thank you very much indeed for that. I looked all over the Internet for a way of switching off modules in subroutines but found nothing!

      I have tried it out and it works. I can now completely get rid of the comments regarding bignum.

        Ahhhh! Thank you very much indeed for that. I looked all over the Internet for a way of switching off modules in subroutines but found nothing!

        Next time forget the internet :D and check the docs :)

        perldoc -f use says .... no integer;