HP Forums
50G Hidden digits with HP RANDom number generator - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: 50G Hidden digits with HP RANDom number generator (/thread-22197.html)



50G Hidden digits with HP RANDom number generator - Gil - 08-19-2024 10:43 AM

The program R12—>3 enables, with 2 consecutive random numbers generated by the HP50G RAND internal command, to determine with brutal force the deleted last 3 digits (when executing RAND).
The next (3rd) RANDom is here also automatically generated and should correspond to the same RANDom number given executing the internal RAND command a 3rd time.

To check the 4th & next random numbers, press — after having executed once the program R12—>3 — the other program R? as many times as wished and compare the results when executing again, each new time, internal RAND command.

No attempt to optimise the program was made.
Here were used strings instead of modulo.
SREPL command was used, but, with some changes, the POS command might have been used.

Code:

\<< "2 Arg:
 RAND RAND (twice)

You get
 \183hidden #s of
  1st & 2nd rand #
 \1833rd rand # (as press
  RAND a 3rd time)

For 4th/other (hidden)
rand #, press R?
" DROP -105 CF DUP2 2851130928467 \-> r1 r2 m1 m2 a
  \<<
    WHILE m1 FP 0 \=/
    REPEAT 10 'm1' STO*
    END m1 R\->I \->STR 'm1' STO
    WHILE m2 FP 0 \=/
    REPEAT 10 'm2' STO*
    END m2 R\->I \->STR 'm2' STO 0 999
    FOR i m1
      CASE i 10 <
        THEN "00" +
        END i 100 <
        THEN "0" +
        END
      END i + OBJ\-> a * \->STR m2 DUP SREPL 0 \=/
      IF
      THEN r1 DTAG "R1" \->TAG i "Hidden R1" \->TAG 1000 'i' STO
      ELSE DROP
      END
    NEXT ROT OBJ\-> 'S' STO R? SWAP DTAG "S2" \->TAG SWAP DTAG "R2" \->TAG R? SWAP DTAG "S3" \->TAG SWAP DTAG "R3" \->TAG
  \>>

[code]\<< "No Arg,
 but run R12\->3 before
" DROP S DUP \->STR DUP SIZE DUP 14 - SWAP SUB OBJ\-> DUP DUP 'S' STO "Sn" \->TAG SWAP \->STR 1 12 SUB OBJ\-> 1.E14 / S LOG IP 12 - ALOG * "Rn" \->TAG 2851130928467 'S' STO*
\>>