📄 random.txt
字号:
TF Random_Roll(unsigned long count, unsigned long magnitude, long floor, long **rolls); Uses the ISO C rand() function, which should be fine for ordinary dice rolls. count is the number of dice to roll, magnitude is the number of sides per die, floor is the smallest value on the die (may be nonpositive). rolls should have a length of count + 1, the result is stored here. rolls[0] contains the sum total of all rolls, rolls[1] through rolls[count] contain the results of individual die rolls. Note: Because we are using a random number up to a power of two and then dividing it to a suitable amount, there is an asymmetry whenever magnitude is not a power of two, making the highest value less likely to appear. We deal with this by dividing such that the highest value is one greater than we allow; if we get this value, we reroll. This does not occur if magnitude is a power of 2, since our 'excess' measure isn't rounded down. (excess = RAND_MAX / magnitude)TF Random_WRoll(unsigned long count, unsigned long threshold, long **rolls); Random number generation is done along the same line as Random_Roll, but in this case we calculate 'successes' a la White Wolf games. 10 is used as magnitude, 1 as floor, threshold is the minimum roll value that counts as a success and must be in the range from 2 to 10. rolls[0] contains a count of successes, 0 for failure, or a negative value for a botch. Other values in rolls are done the same way as Random_Roll. If WROLL_USES_SUCC_FLAG is defined, a negative value for rolls[0] will not occur unless no single roll was successful. (Revised Edition rules)@(#) $Id: random.txt,v 1.1.1.1 2004/01/16 07:28:15 lachesis Exp $
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -