I can print the hex value of a given number using printf
I need to print the hex value of a random number, 0-127, but can't seem to get that working. I tried this:
printf "%02x\n" ${RANDOM}%128
What do I need to do differently?
Thanks,
Mike
Code:
printf "%02x\n" 2 -> 02
printf "%02x\n" 20 -> 14
printf "%02x\n" 200 -> c8
I need to print the hex value of a random number, 0-127, but can't seem to get that working. I tried this:
printf "%02x\n" ${RANDOM}%128
What do I need to do differently?
Thanks,
Mike