Posted: Fri 03 Jun 2005, 05:16 Post subject:
random
Code:
int main() {
int i;
/* init random generator by current time */
srand(time(0));
/* so now display ten random numbers */
for (i=0;i<10;i++){
printf("%d is %g\n",i,rand());
}
return 0;
}
Save this as randtest.c .
execute by tcc -run randtest.c
or
compile it as tcc -o randtcc randtest.c
and run it by ./randtcc
Every time you run it you get a other sequence of ten numbers .
Joined: 04 May 2005 Posts: 15109 Location: Paradox Realm
Posted: Sat 04 Jun 2005, 01:14 Post subject:
Random Sea
Thanks Menno
that will do nicely . . .
the numbers seem to be in
what I believe are referred to as floating point
Tried to find a mod or modulus function
- in fact tried to find a C tutorial and I must 'av
been looking in the wrong caves - coz I found nothing
entiled "C for cructaceans and dumb aquatics"
tinycc - a c compiler and interpreter is too kewl
. . . now it takes two years to learn to program in C
(according to all the best mermaid tales)
If my psychiatrist approves and I can afford the
performance enhancing drugs and mineral supplements
I may go for it.
NB. Only Puppy can do this . . .
Who else is coming? (so to speak)
Last edited by Lobster on Sat 04 Jun 2005, 15:11; edited 1 time in total
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum