Construct Greedy Random Solution

The function has to generate a solution for a candidate using greedy random solution? I figure to use void as it not returning anything but to find a random solution for a candidate.

1
2
3
4
5
6
7
void ConstructGreedyRandomizedSolution(int candidate)
{
    for(int i = 0; i < (rand()%candidate); i++)
    {
        cout << i << candidate << endl;
    }
}
Do you mean this?
https://en.wikipedia.org/wiki/Greedy_randomized_adaptive_search_procedure
I don't know much about the topic, but if you have a C++-related question I can answer it.

Currently, your for loop doesn't make sense - every iteration it generates a new random value to be used in part of the condition expression.
Last edited on
Topic archived. No new replies allowed.