HP Forums
(49G) Nednoc, A Programme of Great Utility, Providing Random Bits - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (49G) Nednoc, A Programme of Great Utility, Providing Random Bits (/thread-20171.html)



(49G) Nednoc, A Programme of Great Utility, Providing Random Bits - Gerald H - 07-14-2023 08:28 AM

Nednoc takes as input some integer produced by some PRNG & returns the number of even digits to stack level 2, the number of odd digits to stack level one, allowing the User (customer, client, operator) to decide on allocating 1 respectively 0 to the preferred larger or lesser of the two.

That's enough utility for one day.

Code:
Size: 81.5

CkSum: # 729Eh

::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^Z>S
    DUPLEN$
    SWAP
    ZEROSWAP
    BINT5
    ZERO_DO
    INDEX@
    DUP
    #+
    #>$
    NULL$
    FPTR F 1A
    COERCE
    ROT#+SWAP
    LOOP
    DROPDUP
    FPTR2 ^#>Z
    3UNROLL
    #-
    FPTR2 ^#>Z
  ;
;