Back to the main page

Mailing List Logs for ShadowRN

Message no. 1
From: What's this button do? <GRAFF85@********.CORTLAND.EDU>
Subject: My gift to a great list
Date: Mon, 21 Mar 1994 14:50:11 -0400
Some of you gurus may have already done something like this but I thought I
would pass it on to you...I was rather proud of it....rolls six siders..

--Dave
--------%X----Cut-Here-----%X-----------
/* Random dice generator written in ANSI C*/
/* Written by Dave Graff: Phlatline */
#include <stdlib.h>
#include <time.h>
#include <stdio.h>


main()
{
int a, num;
srand((unsigned) time((time_t*)NULL));
rand();
printf("How many dice do you want?\n");
scanf("%d", &num);
while(num != 0)
{
num -= 1;
a= 1 + rand() % 6;
printf("Die Role = %d\n",a);
}
}
Message no. 2
From: Chris Ryan <chrisr@****.QUT.EDU.AU>
Subject: Re: My gift to a great list
Date: Tue, 22 Mar 1994 10:55:25 --1000
> Some of you gurus may have already done something like this but I thought I
> would pass it on to you...I was rather proud of it....rolls six siders..

Just a couple of suggestions:

1. It'd be better to use a 'for' loop.

2. Try it out for say 4 or 5 dice to be rolled. Do this many times
(> 20 or 30). How many 1s in a row, or 6s in a row did you get? Any?

Chris

Chris Ryan | Earthdawn List: earthdawn@****.concept.com.au
QDPI/QUT | (email me for subscription details)
Brisbane Qld Australia | President BRISCON Association
chrisr@****.qut.edu.au | (email me for BRISCON 94 convention details)
Message no. 3
From: What's this button do? <GRAFF85@********.CORTLAND.EDU>
Subject: Re: My gift to a great list
Date: Mon, 21 Mar 1994 22:08:33 -0400
>Just a couple of suggestions:
>
>1. It'd be better to use a 'for' loop.
>

don't really see why..i'll try it...

>2. Try it out for say 4 or 5 dice to be rolled. Do this many times
>(> 20 or 30). How many 1s in a row, or 6s in a row did you get? Any?

it's mostly random on my 386DX33, on the vax it's a little more random but hey
it only took me 5 min to write and debug....

--Dave
----v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^-
David Graff | GEEK CODE v1.0.1
339 Randall Hall | GS(CS)@ d+(---) p(-p+) c+(+++) l u- e* m---(*) s !n(n---)
Cortland, Ny 13045| h* f+(--) g++ w+++ t++(---) r(++) y+
607.753.2783 |
--------------------------------------------------------Phlatline-------------
Message no. 4
From: Quid Non <jdfalk@****.COM>
Subject: Re: My gift to a great list
Date: Tue, 22 Mar 1994 00:49:34 -0500
On Tue, 22 Mar 1994, Chris Ryan wrote:

> > Some of you gurus may have already done something like this but I thought I
> > would pass it on to you...I was rather proud of it....rolls six siders..
>
> 2. Try it out for say 4 or 5 dice to be rolled. Do this many times
> (> 20 or 30). How many 1s in a row, or 6s in a row did you get? Any?

It came out pretty happily random for me, no problems really.

One question -- is there a way it could be modified so that
instead of asking each time, it accepts command-line input for the number
of rolls? That'd be a lot easier to work with, IMHO.

==============================================<jdfalk@****.com>============
|| "Welcome to my nightmare ||
|| Its the one in which I always press the button." ||
|| -Roy Harper ||
Message no. 5
From: What's this button do? <GRAFF85@********.CORTLAND.EDU>
Subject: Re: My gift to a great list
Date: Tue, 22 Mar 1994 09:08:10 -0400
> One question -- is there a way it could be modified so that
>instead of asking each time, it accepts command-line input for the number
>of rolls? That'd be a lot easier to work with, IMHO.
>
>==============================================<jdfalk@****.com>============

Yes I thought of that...but I haven't learned that yet :-)

--dave
----v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^-
David Graff | GEEK CODE v1.0.1
339 Randall Hall | GS(CS)@ d+(---) p(-p+) c+(+++) l u- e* m---(*) s !n(n---)
Cortland, Ny 13045| h* f+(--) g++ w+++ t++(---) r(++) y+
607.753.2783 |
--------------------------------------------------------Phlatline-------------
Message no. 6
From: Micah Levy <M.Levy@**.UCL.AC.UK>
Subject: Re: My gift to a great list
Date: Tue, 22 Mar 1994 15:08:29 +0000
>
> > One question -- is there a way it could be modified so that
> >instead of asking each time, it accepts command-line input for the number
> >of rolls? That'd be a lot easier to work with, IMHO.
> >
> >==============================================<jdfalk@****.com>============
>
> Yes I thought of that...but I haven't learned that yet :-)

If it's like C++ (cos' I never learnt C) then it takes arguments to main as
argc and argv where argc is the number of parameters that it takes and argv is
the parameter given.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|| ||
|| Micah Levy ||
|| Department of Computer Science ||
|| University College London ||
|| ||
|| GCS d--@ -p+ c++ l(!) u++ e+ m- s n+ h* f g+(-) w t+ r++ y? ||
|| ||
|| ||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Message no. 7
From: Michael Garoni <Michael_Garoni@****.INTERSOLV.COM>
Subject: Re[2]: My gift to a great list
Date: Tue, 29 Mar 1994 15:37:00 LCL
:]> Yes I thought of that...but I haven't learned that yet :-)
:]
:]If it's like C++ (cos' I never learnt C) then it takes arguments to main as
:]argc and argv where argc is the number of parameters that it takes and argv is
:]the parameter given.

Normal C uses the same parameters. Try something similar to the below code.

Mail me privately if you have a problem with this stuff.

main(argc, argv)
int argc;
char **argv;
{
if (argc > 1) {
/* Enter your program in here */
} /* end if */
} /* end program */

-Obi Wan (Michael_Garoni@****.intersolv.com)
Message no. 8
From: What's this button do? <GRAFF85@********.CORTLAND.EDU>
Subject: Re: Re[2]: My gift to a great list
Date: Tue, 29 Mar 1994 09:39:55 -0400
Coolage...i looked up how to use command line params...unfortunately i don't
have the time to try them out...i will give it a shot!!
--Dave
----v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^---v^-
David Graff | GEEK CODE v1.0.1
339 Randall Hall | GS(CS)@ d+(---) p(-p+) c+(+++) l u- e* m---(*) s !n(n---)
Cortland, Ny 13045| h* f+(--) g++ w+++ t++(---) r(++) y+
607.753.2783 |
--------------------------------------------------------Phlatline-------------

Further Reading

If you enjoyed reading about My gift to a great list, you may also be interested in:

Disclaimer

These messages were posted a long time ago on a mailing list far, far away. The copyright to their contents probably lies with the original authors of the individual messages, but since they were published in an electronic forum that anyone could subscribe to, and the logs were available to subscribers and most likely non-subscribers as well, it's felt that re-publishing them here is a kind of public service.