View Single Post
Old Feb 14th, 2007, 10:52 AM   #4
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3 kruptof is on a distinguished road
Quote:
Originally Posted by InfoGeek View Post
or you can do something like...
  for(i=0;i<100;++i)
     a[i] = i+1;

  for(i=0;i<100;++i)
     swap(a[i], a[rand()%100]);
you should aslo give srand a call before calling rand or everytime you start the program you will get the same random numbers as you got last time you ran the program
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote