I propose adding a dice-rolling and random number generation feature, useful when E.G. playing tabletop RPG games, or when not sure which option/person to pick for something.
The feature should consist of two services, .dice and .random. The first service should accept requests in the standard format kdn(+m.)dice, where k, n and m are numbers. For example:
1d6.dice is a standard roll with a single die.
2d6 is a roll of two standard dice, as used in Monopoly and other board games.
3d20+5.dice is a roll of three 20-sided dice, with 5 added to the total. Such rolls are used in Dungeons and Dragons and other similar games.
I'm not sure if DNS considers + as an acceptable character, if not, we can use / instead.
The service should return the results for each roll separately, as well as the total of all rolls + the modifier.
The second service should accept requests in the format n-m.random, and return a random number between n and m (inclusive).
I'm willing to work on this personally if @knadh considers this useful enough to merge, but I'd love to get their opinion on this first so that my work doesn't go to waste.
I propose adding a dice-rolling and random number generation feature, useful when E.G. playing tabletop RPG games, or when not sure which option/person to pick for something.
The feature should consist of two services, .dice and .random. The first service should accept requests in the standard format kdn(+m.)dice, where k, n and m are numbers. For example:
I'm not sure if DNS considers + as an acceptable character, if not, we can use / instead.
The service should return the results for each roll separately, as well as the total of all rolls + the modifier.
The second service should accept requests in the format n-m.random, and return a random number between n and m (inclusive).
I'm willing to work on this personally if @knadh considers this useful enough to merge, but I'd love to get their opinion on this first so that my work doesn't go to waste.