-
February 12th, 2014, 01:07 PM
#1
[RESOLVED] randomize ( )
Hi,
Is there any randomize ( ) function in Visual C++ 6.0? What is its prototype? Plz guide me.
Zulfi.
-
February 12th, 2014, 02:30 PM
#2
Re: randomize ( )
Victor Nijegorodov
-
February 13th, 2014, 12:05 AM
#3
Re: randomize ( )
Hi,
Thanks for your response. I usually check google because it provides example code also. I found following link from MSDN but it does not even tell me its prototype.
http://msdn.microsoft.com/en-us/library/dd354946.aspx
The link you have provided tells me about random function. I am looking for randomize().
I have tried stdlib.h and ctime.h but its still saying undeclared identifier. Plz guide me.
I have following header files included in my code:
#include "stdafx.h"
#include "LaserGraph.h"
#include "LaserGraphDoc.h"
#include "LaserGraphView.h"
#include <stdlib.h>
#include <time.h>
#include <iostream.h>
#include <math.h>
//#include "time.h"
Last 4 are added just for randomize().
Zulfi.
Last edited by Zulfi Khan2; February 13th, 2014 at 12:11 AM.
-
February 13th, 2014, 12:21 AM
#4
Re: randomize ( )
Originally Posted by Zulfi Khan2
Hi,
Thanks for your response. I usually check google because it provides example code also. I found following link from MSDN but it does not even tell me its prototype.
http://msdn.microsoft.com/en-us/library/dd354946.aspx
The link you have provided tells me about random function. I am looking for randomize().
I have tried stdlib.h and ctime.h but its still saying undeclared identifier. Plz guide me.
I have following header files included in my code:
Last 4 are added just for randomize().
Zulfi.
You asked for a randomize function for VC++ 6.0...the link Victor gave you is for that exact function, it is called srand(), and NOT randomize(), there is no such function for VC++ 6.0...his link also gave you the prototype and example code.
Jim
ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII
"The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.
"Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.
-
February 13th, 2014, 01:03 AM
#5
Re: randomize ( )
Hi,
Thanks for your information.
Zulfi.
-
February 13th, 2014, 07:58 AM
#6
Re: randomize ( )
Note: rand() is pretty much unusable for any but the most simplistic usage cases.
it's period is too short
the generated bits per random number are small
it's cryptographically unsafe
it's too predictable (you can derive the seed from a single output)
it has poor dimensional distribution (it's "unstable", causes streaky artefacts)
The fact it's uniform over 32k, with 32k period and 32k values means it's output isn't even technically "random" because it's impossible to ever get the same 15bit value in succession.
You're much better off using the random features from the C++ <random> header.
hint: the mersenne twisters are very good random number generators.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|