ROLLDICE(6) Linux ROLLDICE(6) 12 FEB 1999 NAME rolldice - rolls virtual dice SYNOPSIS rolldice [ -v | --version ] [ -r | -u ] dice string DESCRIPTION rolldice rolls virtual dice. The dice string passed on the command line contains information on the dice to roll in a format comparable to the format used in fantasy role playing games. OPTIONS -v,--version returns the version of diceroll -r uses /dev/random for random number generating -u uses /dev/urandom for random number generating DICE STRING FORMAT The dice string uses the following format: {#x}{#}d[#|%]{*#}{+/-#} {#}d[#|%] This is the only required part of the string. The first number is the number of dice to roll, and the second number is the number of sides the dice have. The numbers rolled on each die are then added up and given as the result. Hence 3d6 means "roll three six-sided dice, add them together and return the result". If the first number is left out, then the number of dice defaults to 1. If the second number is not a number, but a percentage sign, then the number of sides becomes 100 (for a percentage roll). {#x} This number tells how many times to roll. For example, if you want to roll 3 6-sided dice 6 times, you would say 6x3d6. This would return six numbers, corresponding to the six different rolls. {*#} This number tells how many times to multiply the result of each roll. 3d6*100 would return a number in the range of 300-1800, since 3-18 is the range resulting from 3d6, which is then multipled by 100. {+/-#} This number is the modifier to be added or subtracted, depending on the sign, from each roll. 1d4+1 would result in a range from 2-5 (1-4 for the die, plus 1). - 1 - Formatted: April 25, 2024 ROLLDICE(6) Linux ROLLDICE(6) 12 FEB 1999 in the order show above. For an extreme example, "3x4d6*5+1" would roll four six-sided dice, multiply the result by 5, add 1 to that, and repeat the process two more times, for a total of three results. DIAGNOSTICS The following error messages may appear on STDERR: Failure in getting dice attributes Either memory could not be allocated while parsing the string passed to the rolldice program or an invalid dice string was entered. Failure in rolling dice Memory could not be allocated while actually rolling the dice. Unknown option Take a wild guess ;) BUGS I haven't noticed any yet... rolldice is a quick hack to provide a virtual dice roller for FRPGs that I play. Any improvements are greatly welcome, as I am not the most experienced C coder... AUTHOR Stevie Strickland <sstrickl@resnet.gatech.edu> VERSION 1.4 - 12 Feb 1999 - 2 - Formatted: April 25, 2024