[comp.sys.amiga] rand

AAW151%URIACC.BITNET@brownvm.brown.edu (Andy Patrizio) (12/03/90)

In going through ANSI C, one of umpteen books on C programming, reference is
made to a command called rand() that will generate random numbers.

First off, is this possible under Lattice C? And second, how exactly is it
done? The book doesn't elaborate.

-----
Bitnet: aaw151@uriacc.bitnet                       |  Andy Patrzio
ARPA: aaw151%uriacc.bitnet@brownvm.brown.edu       |  Box 705 Ellery Hall
Internet: aaw151@uriacc.uri.edu                    |  URI
Usenet: simon@sbs.bbs.com                          |  Kingston, RI 02881
...or...: andypo@idsvax.ids.com                    |  (401) 782-2758
UUCP: ..uunet!rayssd!idsvax!andypo
-----
"I'm taking Psychobabble for my language requirement" - me.
-----

martens@python.cis.ohio-state.edu (Jeff Martens) (12/03/90)

In article <37886@nigel.ee.udel.edu> AAW151%URIACC.BITNET@brownvm.brown.edu (Andy Patrizio) writes:
>In going through ANSI C, one of umpteen books on C programming, reference is
>made to a command called rand() that will generate random numbers.

>First off, is this possible under Lattice C? And second, how exactly is it
>done? The book doesn't elaborate.

Lattice C, except for the possibility of running out of memory, is
turing complete.  So you can certainly do it in Lattice C.  Most
programming languages come with random number generators as part of
the language or in a library, but many are garbage (e.g. unix rand()
or the random # function that TDI distributed with their Modula 2).
If you need a good random number generator, you might want to read
this article:

@article{ParMil:88,
	author = {Stephen K. Park and Keith W. Miller},
	title = {Random Number Generators:  Good Ones are Hard to Find},
	journal = {CACM},
	year = {1988},
	month = {October},
	volume = {31},
	number = {10},
	pages = {1192 -- 1201}
}


Of course, if you're just writing a game it doesn't probably matter.

Please note that I've redirected followups to c.s.a.tech.
--
-- Jeff (martens@cis.ohio-state.edu)

	"Until you stalk and overrun, you can't devour anyone" -- Hobbes.