[gameprogrammer] Re: Making random numbers in C++
- From: "milos chmel" <xchmelmilos@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Wed, 31 Dec 2008 21:03:39 +0100
srand(int) won't generate you random nubner it will only start the
generator ....
Generating random number in stdlib is implemented like:
global int x
void srand(int start_value) {
x = start_value
}
int rand(void) { // that what you need
x = some_function(x)
return x
}
2008/12/31, Azeem Zaheer <azeem_841@xxxxxxxxxxx>:
>
> hii know this question is not directly related to game programming, but I am
> sure u guyz can help me out.I am making a program in which I need about
> 10,000 "random" numbers ranging from 1 to 10.I have to make it in C++.So,
> when I use srand(time(NULL)); it works..but it is tooo slow.I takes 1 whole
> second to process and generate 1 number.I will have to wait 1000 secs, which
> is hell of a time.Please suggest me someway to make random numbersmore
> quicker.Just tell me how to make 1 random number in 1 millisecond or even
> less.I am really waiting for your reply.Thanks in advance.and HAPPY NEW
> YEAR.
> _________________________________________________________________
> Invite your mail contacts to join your friends list with Windows Live
> Spaces. It's easy!
> http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
--
"Brevity is the soul of wit." by William Shakespeare
" It IS NOT all FACTS. It IS TRUE. I believe it SHOULD NOT BE BELIEVE
LITERALLY. It IS TRUE." - jorgipogi
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
Other related posts: