Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

rand

Name: Anonymous 2009-10-27 11:51

How do I get a random number between nMin and nMax?
I tried using:
   srand(time(0));
   int x = rand() % nMax + nMin;
...

I will use this to randomize the starting point of particles in a particle system.

Name: Anonymous 2009-10-27 12:00

how is babby formed
how girl get pragnant

Name: Anonymous 2009-10-27 12:05

+ (random (- nmax nmin)) nmin

or something like that

Name: Anonymous 2009-10-27 12:13

$rand = mt_rand($nmin, $nmax);

Name: Anonymous 2009-10-27 12:21

>>1
Why are you positioning them randomly?

Name: Anonymous 2009-10-27 12:23

>>5
He doesn't want the particle to have a preconceived idea of how to position themselves

Name: Anonymous 2009-10-27 12:25

>>6
But... they will have preconceived ideas, he just won't know what they are

Name: Anonymous 2009-10-27 12:26

int x = (rand() % (nMax - nMin)) + nMin;

Name: Anonymous 2009-10-27 12:26

>>1
What's the question exactly?  You did everything right.  Although I would use time(NULL) rather than time(0) but it makes no real difference.

sage for pointless thread

Name: Anonymous 2009-10-27 12:27

>>7
And suddenly the student was enlightened

Name: Anonymous 2009-10-27 12:30

sage for pointless thread
ತ_ತ I don't think you know what sage is for

Name: Anonymous 2009-10-27 12:35

OP here, thanks I got it now
I did rand(nMax-nMin)+nMin;
I still have a little problem, though.
Sometimes a couple or more particles start from the same position and they look like worms.

Name: Anonymous 2009-10-27 12:35

But ill figure it out myself

Name: Anonymous 2009-10-27 12:36

rnd(min, max);

Name: Anonymous 2009-10-27 13:10

r(k, j)

Name: Anonymous 2009-10-27 13:11

Here's a random number

16

feel free to use it however you want

Name: Anonymous 2009-10-27 13:23

I just make a appropriately-sized cardboard die and throw it.
If you're short on time, you can keep throwing Xd10 until you get a number in range (flip a coin to determine sign).

Name: Anonymous 2009-10-27 13:26

>>17
Expert Fa/tg/uy

Name: Anonymous 2009-10-27 15:34

Name: Anonymous 2009-10-27 15:52

>>19
I always love it when people make ridiculously large and extravagant things just because they can

Name: Anonymous 2009-10-27 17:25

>>20
If you like large and extravagant things, you'll want to check out my penis

Name: Anonymous 2009-10-27 17:30

>>21
I have it on good authority that your penis is not as large and extravagant as you claim, but that it only seems that way since you are stuck in Asia

Name: Anonymous 2009-10-27 19:06

>>21
If you like being a faggot, you'll want to use italics.

Name: Anonymous 2009-10-27 20:58

>>12
Clusters occur in random generation.

Name: Anonymous 2009-10-27 21:01

>>24
cont.
If you don't want clusters to occur you should consider a quasi unique random generator. Google is your friend for this problem.

Name: Anonymous 2011-02-02 23:37

Don't change these.
Name: Email:
Entire Thread Thread List