[pmwiki-users] Rand HexRand

Hans design5 at softflow.co.uk
Sun May 11 16:28:08 CDT 2008

Saturday, May 10, 2008, 8:18:00 PM, Doug Parker wrote:

> I know

>    {(rand w x)}

> will give me a random number from x to y. Can a hex random function

>    {(hexrand #y #z)}

> be created, or built off the rand function to generate random hex
> values or digits?

Define a decimal to hexadecimal conversion markup expression in
config.php, for instance like:

# add {(dec2hex .....)} markup expression, argument is decimal number
$MarkupExpr['dec2hex'] = 'dechex($args[0])';

Then use in the page for a random hex number (for instance a two
digit hex number)(the random integer gets converted to hex):

{(dec2hex (rand 16 255))}


More information about the pmwiki-users mailing list