Logo Search packages:      
Sourcecode: kbruch version File versions  Download package

void task::make_numerators ( int  main_denominator,
short  pnr_ratios 
) [private]

set the numerators randomly

Definition at line 550 of file task.cpp.

Referenced by create_task().

{
    /* I think it is to easy to deal with ratios like 1/1 or 4/4; so
     * I limit the maximum of a numerator */
    int max_numerator = int (main_denominator * float (0.7));

    /* add a new ratio to the task and compute the numerator randomly */
    for (short tmpcounter = 0; tmpcounter < pnr_ratios; tmpcounter++) {
        (*this).add_ratio (int ( (double (rand()) / RAND_MAX)
                                 * max_numerator) + 1, 1);
    }
    return;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index