I feel there must be a better way to achieve this. As best I can determine, I can’t use the ToBinary max digits option because my numbers are too big (48 bits). So I’ve resorted to this kludgy string fix.
Also, I couldn’t find a command in Xojo equivalent to an old BASIC concept of printing multiple characters such as binary$ = CHAR(“0”, 48). Anything out there like this?
var b as string var l as integer l = 48 // Number of binary digits for n as integer = 1 to 10 // Print 10 examples b = Bin(system.random.inrange(0,2^l-1)) // Generate a random number and convert to binary // Make sure leading zeros are prepended to ensure total number of binary digits. if len(b)<l then b = left("000000000000000000000000000000000000000000000000",l-len(b)) + b End system.debuglog(b) next