Guys can anyone please explain to me the working of this function { "randamise()" }.

i have been working with many c++ projects but never came across randomize() function. is it user defined or in_built function?

commented: Ofcourse it is inbuilt function. +0

We can't guess what a function does. If we saw the code, we might be able to help you.

AFAIK this 'function' is just a Borland specific macro used in Turbo c++ and c++ builder. As I don't have access to these ancient headers, I've no idea of the implementation.

Ah, I see. It's a function in a library provided to you by Borland twenty years ago. It's not a standard function. Check the documentation.

I would recommend that you use tools from at this century. Maybe even from this decade.

Unfortunately, a lot of schools are still using seriously outdated tools, such as Borland C/C++. This is just absurd, and not suitable to train new programmers.

It makes no sense. Newer, better tech is free and easier to use. The only reason I can think of that schools don't use free, better, easier tools is that the instructors have been teaching the identical course for thirty years and don't want to have to rewrite their notes.

Considering that most of the instructors in question also teach C++ as if it were C - using the stdio functions instead of iostream, not covering classes at all, etc. - I would say this is likely.

Can't imagine only old teachers teaching the same things for some 30 years, and no new teachers starting with some fresh ideas.
Maybe it's imposed by some governments?

In some cases, it is, or at least that is what I understand; from what I have heard, the university systems of India and Pakistan, in particular, mandate that Turbo C++ be taught as the only programming system, and base all their educational and testing requirements on it. No other language is permitted in their coursework, except assembly, and no other compilers or editors are to be used either. I have been told that efforts to update the curriculum have been made over the years but have been dismissed out of hand by the educational establishment as unnecessary - they see it as making changes for the sake of change, and consider anything less than 25 years old as a temporary fad.

I am not certain if this is the case in the Phillipines, but it may well be given the number of students from there who are taught in this manner.

The situation strikes me as very much like that which Feynman noted about physics teaching in Brazil in the 1950s - the focus is entirely on testing out of the program, and no real understanding is being imparted or even attempted to be imparted. The sheer number of students of computer science in India in particular means that a fair number of talented programmers do come out of their system, but it seems to be in spite of the system than because of it - much like in the US, though for the opposite set of reasons. Computer science is hardly taught (successfully) in the US at all, but (to paraphrase Feynman) there is no computer science being taught in India - there are a lot of courses and entire schools for the subject, but actual comprehension is entirely missing! The result is that its entirely by chance that anyone of actual ability comes out of either system.

i take it that computer science/engineering is a passion. for instance, university in Malawi teaches the above sub but practically they are lacking.

do u mean that ???

#include<cstdlib> //contains function prototype for rand
using namespace std;
int main()
    //example for loop 20 times
    for(int count=0;count<20;count++){
        cout<<setw(10)<<1+rand() %6;
    return 0;

Not exactly; as was explained above, in the old Borland C++ compilers, there was a macro actually called randomize() that was basically a shortcut for both initializing the randomizer and returning a random value. While I don't know the actual implementation, I'm guessing it was something along the lines of

#define randomize(n) srand(time(NULL)); n = rand();

If anyone could give more details, it would be... oh, who am I kidding? It wouldn't be worth much of anything to know exactly, since it is basically a dead issue for anyone using a standards-compliant compiler and library.

Member Avatar


I remember "randomize" only from BASIC.