My first serious topic

Hello! This topic is serious. I using Borland C++ Builder 6.0 just because of I dont know where is random() function in Visual C++ 7.0. I searched RANDOM function in all (*.*) VCs files (FULL INSTALL), but nowhere found it. Please, help me, if you know in which header lays RANDOM function for generation random numbers.


#include <stdlib.h>

int mynumber = rand();

// mynumber will be a number between 0 and RAND_MAX (defined in stdlib.h). You can then convert it to any range you like.

From MDSN:
The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. Use the srand function to seed the pseudorandom-number generator before calling rand.

I was going to email C++ privately, but I realized that other people might benefit from this information as well…


You REALLY need to go to a site like to ask questions about random functions, and other things that have absolutely nothing whatsover to do with the specific use of OpenGL.

I have founded this in MSDN’s examples:
/* GetRandom returns a random integer between min and max. */
#define GetRandom( min, max ) ((rand() % (int)(((max) + 1) - (min))) + (min))
Also you can use this: (i didn’t remember where i founded it…)
float getRandomMinMax( float fMin, float fMax )
float fRandNum = (float)rand () / RAND_MAX;
return fMin + (fMax - fMin) * fRandNum;
Or use:
int random_number = rand()%10; // this will generate number from 0 to 10

Originally posted by knackered:

I agree whole heartedly… (Seriously too…)

BEGIN “TO KNACKERED (for his sigh)”
(South pole. Beach. Sun. Warm water. Flowers, singing birds… Silence… … …
Suddenly! (Intimately))

  • – Oh, boy! More deeply! More deeply!*
    (Nice & lovely joke. Without insults, OK?)

Hello! Thank you (knackered, gvm) for your answer (very useful). What is MSDN? As far as I`ve understood, MSDN is help database? How much it costs to order it by mail (For example, there where you are living)?

(a) It’s free

(b) You’re a dickhead

MSDN is just a searchable database of documents provided free by microsoft to try to help people to be able to write programs under their hellish operating system.
It stands for MicroSoft Developer Network.
Just go here:

Now please c++, don’t post anymore questions here. You’re making a fool out of yourself - you’re not eloquent enough to be entertaining…this isn’t an insult, because your english is certainly better than my russian - it’s just advice. From what I gather from your posts, you are a beginner in OpenGL and in Windows programming…that’s no problem, everyone has to begin somewhere - but here in this forum is not the proper place to begin.

Hello, knackered! Im not beginner in Windows programming and I have MSDN. I bought it on 3 CDs in the piratess shop and paid $8. I just found out that MSDN is free for copying.
Why you so hate Windows? I love Windows. Under Windows works all my favourite progs. Probably others OSes works much better but I still love Windows. Please, list (I know nothing about the reason of hatred) some critical lacks of Windows :slight_smile:
About posting. OK, I promise Ill never post even one off-topic (I understand only good form such as your). About english. Was a time when you didnt know even a single word in english. And now you strewing thousands of words. Question: why? Answer: because you have unlimited practice in english language evey day. For example, small and ugly american child (Which will in future consume a lot of resources of planet Earth (of course, including russians oil) in time when all other childs in the world will not have even a living necessary minimum of food (In Russia and not only but, except of "narrow eyes" (from China) because they breed as rabbits and Im not fell pity for them)) learn out american language because IT has a practice and hear speech. And I havent such opportunities. So, you know english much better than I. P.S. "The Chinese army began to penetrate through Russias border by small groups. Each group includes one million soldiers."

Mmm, you’re beginning to scare me now, c++.
This is not the place for this kind of talk. Go to flipcode, and rant on to them…they will absolutely love you.

Originally posted by C++:
I`m not beginner in Windows programming
Most of us don’t need to tell people this.

What is MSDN?

I`m not beginner in Windows programming

'Nuff said.