Click here to Skip to main content
15,898,769 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestioncapCreateCaptureWindow - source code wanted Pin
Vaclav_29-Dec-08 8:21
Vaclav_29-Dec-08 8:21 
AnswerRe: capCreateCaptureWindow - source code wanted Pin
Randor 29-Dec-08 8:52
professional Randor 29-Dec-08 8:52 
GeneralRe: capCreateCaptureWindow - source code wanted Pin
Vaclav_30-Dec-08 7:09
Vaclav_30-Dec-08 7:09 
QuestionHow to find an Access violation error(involving CStringT) in 3rd Party program Pin
Larry Mills Sr29-Dec-08 6:37
Larry Mills Sr29-Dec-08 6:37 
GeneralRe: How to find an Access violation error(involving CStringT) in 3rd Party program Pin
CPallini29-Dec-08 7:56
mveCPallini29-Dec-08 7:56 
GeneralRe: How to find an Access violation error(involving CStringT) in 3rd Party program Pin
Randor 29-Dec-08 9:02
professional Randor 29-Dec-08 9:02 
GeneralRe: How to find an Access violation error(involving CStringT) in 3rd Party program Pin
Larry Mills Sr29-Dec-08 11:35
Larry Mills Sr29-Dec-08 11:35 
QuestionRandom seeding in C++ different to Java? Pin
c#_keithy29-Dec-08 6:16
c#_keithy29-Dec-08 6:16 
In the main method of some code I'm re-factoring to Java there is this call in the main method, which i presume is seeding all the random numbers.

srand(0);

In my java interpretation of this code I have used the following call

app.randomiser.setSeed(0); //(randomiser = new Random());

The main problem is that as I posted earlier, I'm trying to do in-line what the following #define call in the C++ code does;

#define rand01 (0.9999999*double(rand())/RAND_MAX)

I know this produces random numbers between 0 and 1, which is then applied to a integer variable Ne (800) to produce a random value from 0 to 800 which is then floored to produce the integer value.

neurSwitch = randomiser.nextDouble(); // This is how I produce the random in Java

r = (int)(Math.floor(Ne*generateRandom())); //Random applied to the variable Ne in Java, getRandom returns the value of neurSwitch

The C++ code does this all in one line thanks to the #define statement

val = floor(N*rand01);

The two different implementations are producing massively different results, which is kinda an issue, as I'm trying to exactly reproduce the functionality from the C++ code.

My 2 questions are:

Does the seeding function work differently in Java and C++?

Is the Java reproduction of the #define rand01, doing the correct thing?

Many thanks

Give me strength, give me caffeine

GeneralRe: Random seeding in C++ different to Java? Pin
Luc Pattyn29-Dec-08 6:26
sitebuilderLuc Pattyn29-Dec-08 6:26 
QuestionRe: Random seeding in C++ different to Java? Pin
CPallini29-Dec-08 7:50
mveCPallini29-Dec-08 7:50 
AnswerRe: Random seeding in C++ different to Java? Pin
BobInNJ29-Dec-08 9:44
BobInNJ29-Dec-08 9:44 
GeneralRe: Random seeding in C++ different to Java? Pin
CPallini29-Dec-08 10:07
mveCPallini29-Dec-08 10:07 
GeneralRe: Random seeding in C++ different to Java? Pin
BobInNJ29-Dec-08 10:33
BobInNJ29-Dec-08 10:33 
GeneralRe: Random seeding in C++ different to Java? Pin
Luc Pattyn29-Dec-08 10:43
sitebuilderLuc Pattyn29-Dec-08 10:43 
QuestionWM_USER ignored by View window? (CHtmlView) Pin
nobaq29-Dec-08 1:43
nobaq29-Dec-08 1:43 
AnswerRe: WM_USER ignored by View window? (CHtmlView) Pin
Roger Stoltz29-Dec-08 2:24
Roger Stoltz29-Dec-08 2:24 
AnswerRe: WM_USER ignored by View window? (CHtmlView) Pin
KASR129-Dec-08 19:21
KASR129-Dec-08 19:21 
Questionbinary search tree Pin
foshia29-Dec-08 1:30
foshia29-Dec-08 1:30 
AnswerRe: binary search tree Pin
Maximilien29-Dec-08 3:02
Maximilien29-Dec-08 3:02 
QuestionIntelliSense:'No additional information available' in VC++2005. Pin
Le@rner29-Dec-08 1:17
Le@rner29-Dec-08 1:17 
AnswerRe: IntelliSense:'No additional information available' in VC++2005. Pin
Hamid_RT29-Dec-08 1:31
Hamid_RT29-Dec-08 1:31 
GeneralRe: IntelliSense:'No additional information available' in VC++2005. Pin
Le@rner29-Dec-08 1:54
Le@rner29-Dec-08 1:54 
AnswerRe: IntelliSense:'No additional information available' in VC++2005. Pin
Jijo.Raj29-Dec-08 3:08
Jijo.Raj29-Dec-08 3:08 
AnswerRe: IntelliSense:'No additional information available' in VC++2005. Pin
Randor 29-Dec-08 8:39
professional Randor 29-Dec-08 8:39 
Questionchange background color of dialog Pin
zhiyuan1629-Dec-08 0:59
zhiyuan1629-Dec-08 0:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.