I see what you're saying, rcgldr. Thanks for the links.
Type: Posts; User: dnj23
I see what you're saying, rcgldr. Thanks for the links.
The books I've read don't define it well, but I understand what you mean.
I see. I thought the comma operator guaranteed left to right evaluation, but I guess it behaves differently as an argument list.
I simplify my examples to facilitate the point. I forgot to...
The following program prints this, which is what I want it to do:
#include <stdio.h>
#define MAX_TERMS 5
int ret_one(int);
I'm doing combinatorial analysis on certain card games, where generating certain outcomes can lead into very large iterations.
well, that's something that didn't seem so obvious with me. I...
Wow, thanks for the great replies. I'll just have to experiment around.
I did. It varied somewhat but no more than .1 of a second. I guess with multitasking and all, the OS comes into play...
Consider the following 2 looping statements:
a) while(counter <=MAX_COUNT) counter++;
b) while(counter++ <= MAX_COUNT);
When I set counter to 1 and MAX_COUNT to 4 billion (counter and...
check that your text file has correct input. It should print out 45 1's.
It's good practice to also close the file pointer at the end:
fclose(fp);
It's also commonly used in formatting output with a lot of data when printed with iterations.
If you needed to display, say 10,000 numbers, % c could mean to place a newline every c numbers,...
also make sure if n should = 0,to handle it appropriately.
I've crashed many of my programs with unforseen division by zero.
also, depending on the precision of your data,you should really use type double if you get incorrect answers
You are performing integer division here:
f_A = ((2*genotype[1])+(genotype[2]))/(n*2);
You have to instruct the compiler that it's floating point division, by putting a cast operator
to one of...
I get it now. Thanks guys.
consider the statement :
i >= 0 ? positive_case() : negative_case();
Does :? need to call and evaluate both functions to execute, or does it just
call and evaluate one or the other function...
I tried it, and so far it works again. Haven't been using it though for the past few days. I'll keep my fingers crossed.
The window can't be closed no matter what you try. The OS can't even close it during shutdown.
MS is aware of the bug:
You cannot close a console window of an application after you stop debugging...
I tried the compiler out and have problems with it.
First, the program window wouldn't close when in debug mode, only when the program terminated normally. The window would stay open even through...
Understood, what I mean is the probability of occurrence for each of the six values should be accurate up to a certain decimal place, given a sufficient number of rolls.
I will experiment...
Now I understand what you guys are talking about.
rand() % 6 produces 1 too many 0 and 1 outcomes, with the totals being:
0 : 5462
1 : 5462
2 : 5461
3 : 5461
4 : 5461
5 : 5461
Correct, I meant unbiased.
do {
die1 = rand();
} while (die1 < (RAND_MAX / 6) * 6);
die %= 6; // safe to do this now
cool page, thanks.
hello,
I need a good RNG. I have tried rand() with srand(time(NULL)) and it does not work accurately. I tested it with simulating a craps pass line bet 1 billion times and some of the figures...