Looking for any source code with random function

Status
Not open for further replies.

yanne

Newbie level 4
Joined
Aug 10, 2004
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
45
random function

can you pls send any source code that uses random function,, any thnks! :lol:
 

Re: random function

hi ,
this is simple dice roll function written and tested in C language. :idea: :roll: :wink:


Code:
void roll(){

srand((unsigned) time(&t));
rol=rand()%7; display();

}

evey time when u will call this function. The variable rol will get new random value range from 1 to 6. To increase the range of random numbers use greater number instead of7 in
rand()%7;

hope it'll work for u...
 

Re: random function

hi
i not sure will this be helpful or not. but they explain random in very engineering term.

h**p://www.embedded.com/showArticle.jhtml?articleID=20900500

wisely
 

Re: random function

thanks,, your help means a lot to me thnks!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…