Date: Sun, 4 Oct 2020 09:03:02 +0200 From: Paul Floyd <pjfloyd@wanadoo.fr> To: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org> Subject: Re: Hi, I wrote a FOSS D&D dice rolling program Message-ID: <700AED36-5C96-46F1-8DD4-79005FA61001@wanadoo.fr> In-Reply-To: <SN6PR05MB6318AD237BF47BF8E2CB06DAFA0E0@SN6PR05MB6318.namprd05.prod.outlook.com> References: <SN6PR05MB6318AD237BF47BF8E2CB06DAFA0E0@SN6PR05MB6318.namprd05.prod.outlook.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 4 Oct 2020, at 00:19, Raj J Putari <jmaharaj2013@gmail.com> wrote:
> typedef double long int64;
Eh? Thankfully this doesn=E2=80=99t seem to be used.
> struct Dice {
> int Sides;
> char description[700];
Doesn=E2=80=99t this overflow after say 50 rolls?
> struct Dice Roll;
> int rRandSeed;
> time_t CurrentTime;
=20
> Roll.Sides =3D Dice_Sides;
> time(&CurrentTime);
> rRandSeed =3D (int)rand() % Roll.Sides;
So you get the time and then do nothing with it. I=E2=80=99d expect the =
time
to be used to seed the random number generation vi =E2=80=98srand()=E2=80=99=
rand() isn=E2=80=99t 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=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?700AED36-5C96-46F1-8DD4-79005FA61001>
