Announcement

Collapse
No announcement yet.

Steve's random seed in Source Code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    Originally posted by Rod
    a sleeve or brace can do wonders
    Thanks, Rod. Amazon does a pile of sleeves and even if expensive ones don't work I will not be out of pocket much.

    Comment


    • #62
      What did you use for a timing calculation. I'm not finding the same as you.
      I just tried with TIMER and the start is the same as the end in both Stuart;s and my code,
      TIX gave me 31,000,000 to 42,000,000 cycles.
      In Stuart's code TIX gave me 33,000,000 to 44,000,000, which is pretty good considering the number of pseudo-random numbers generated.

      Never mind, I see you adjusted Stuarts Code for the CryptoRndIII
      Rod
      I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

      Comment


      • #63
        Originally posted by Rod
        I just tried with TIMER and the start is the same as the end in both Stuart;s and my code,
        That isn't the case. If you are not careful you could end up timing stuff in Stuart's code which is not part of the 'crunching'. I did quite a bit of, how can I put it, shuffling to make sure only 'crunch code' got timed.

        For timing, I use Light macro timers. The thread is only three posts long. I often time several sections of code and output the results at the end of the application session. We can have up to 16 timers as the inc file stands. The resolution is less than TIX at 100ns with an 'out of the box' Windows 10 - good enough for me.

        Note the caveat in post #3.

        Comment


        • #64
          Hi Steve, your code in post#49 will also display repeating card numbers, is there a way to sieve out these repeats?

          Comment


          • #65
            I found the duplicate, I will have to have a look at it.
            hutch at movsd dot com
            The MASM Forum

            www.masm32.com

            Comment


            • #66
              Originally posted by Rodney Hicks View Post
              You really don't need all that pseudo-randomness when just a little will do. Should work in PBCC or PBWIN.
              Code:
              '...
                FOR mx=1 TO 6
                  rd=RND(24,28) '5 possibilities
                  '...
                  'lots of deterministic code
                  ...
                  rd=RND(3,4) '2 possibilities which dictate next randoms
                  IF rd=3 THEN
                    rd=RND(16, 18) 'Either  these 3 possibilities
                    '...
                    'lots of deterministic code
                    ',,,
                  ELSE
                    rd=RND(12,14) 'OR 3 other possibilities
                    '...
                    'lots of deterinistic code
                    '...
                NEXT mx
               '...
              '
              ]
              I knew there was something bothering me about this:

              Based on the random numbers used, each iteration only has 30 possible paths

              24,3,16
              24,3,17
              24,3,18
              24,4,12
              24,4,13
              24,4,14
              25,3,16
              ...
              28,4,14

              So after the first iteration, you will have a maximum of 30 possible re-arrangements
              (I haven't examined the code to determine if they are unique, but I'll give them the benefit of the doubt)

              Assuming they are unique, after the second iteration, you will have 30 x 30 = 900 possible arrangements
              After 6 riffle shuffles, you have 30 ^ 6 = 729 000 000 possible outcomes. That is way short of the number of possibilities with a Knuth/FY or other decent shuffle algorithm, regardless of what PRNG you use.





              Comment


              • #67
                Well 1 out of 729,000,000 possibilities for the next hand played is far more 'random' than your favourite 6/49 lottery.

                But wait, there's more!

                RND(24,28) could have been, and still could be, RND(21,31) and RND(16, 18) could be RND(14,20) and RND(12,14) could be RND(10,16).

                I merely showed a quick and dirty solution that doesn't rely wholly on dubious pseudo-random techniques.

                I did not say it had to be limited to 6 riffles, but 6 was enough to show enough randomness for a 'next' hand even with the small pseudo-random ranges invoked.
                Rod
                I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

                Comment


                • #68



                  I got a pair of "Rymora Knee Support Brace Compression Sleeves" from Amazon. They had a good spec but only knocked me back £26.

                  The acid test was climbing stairs. I had been reduced to 'right foot on one stair', 'left foot on same stair' and so on. I couldn't push on my left leg. Earlier I did 'right foot on one stair', 'left foot on next stair up' and so on as most people do. Wow!

                  Walking is easier. My right leg used to take the brunt to the extent that all my shoes have the right heel worn down and the left heel with hardly any wear. Today I was much closer to normal walking.

                  I gave the exercise bike a whirl and did not have to lean over to my right. The resistance used was much less than I used to use but, hey, I was cycling. It hurt but the pain got less as I got into a rhythm.

                  Got to be the best £26 I've spent in a long while.

                  Thanks, Steve and Rod.

                  Comment

                  Working...
                  X