samedi 3 octobre 2020

How to randomize a hex value between ''00' - 'FF' in PHP

So, through PHP I am trying to randomize a hex value between 00 and FF. I want to use this as a value for (example):

fseek($f, '0x01B6F0');
fwrite($f, pack('c', hexdec(""MY RANDOMIZED VALUE")));

I see some examples on my internet searches on how to randomize the location, by which I mean 0x000000 - 0xFFFFFF, but I am only interested in the value. Sorry, I don't know the lingo like 'offset' and such to clearly state what I mean, but I think I stated it well enough to get suggestions on how to do this (like '0C' or '47'... or 0x01B6F0:0C). Thanks!




Aucun commentaire:

Enregistrer un commentaire