Hi, I wrote a FOSS D&D dice rolling program

Paul Floyd pjfloyd at wanadoo.fr
Sun Oct 4 07:03:07 UTC 2020



> On 4 Oct 2020, at 00:19, Raj J Putari <jmaharaj2013 at gmail.com> wrote:

> typedef double long int64;

Eh? Thankfully this doesn’t seem to be used.

> struct Dice {
>   int Sides;
>   char description[700];

Doesn’t this overflow after say 50 rolls?

>    struct Dice Roll;
>    int rRandSeed;
>    time_t CurrentTime;
    
>    Roll.Sides = Dice_Sides;
>    time(&CurrentTime);
>    rRandSeed = (int)rand() % Roll.Sides;

So you get the time and then do nothing with it. I’d expect the time
to be used to seed the random number generation vi ‘srand()’

rand() isn’t the greatest of random number generators, but I
suppose that it is OK for DND dice rolling.

If you want people to use your code, it will need to be
more complete and tested.

A+
Paul


More information about the freebsd-hackers mailing list