In this paper, we present the problem of strategic bidding under uncertainty in a wholesale energy market, where the economic remuneration of each electricity generator depends on the ability of its own management to submit price and quantity bids. This stochastic problem is highly nonconvex, and due to its difficulty there has been an intensive search for efficient algorithms to solve it. We present a bilevel formulation for the problem and propose a genetic algorithm for its solution, where the individual of the population represents the choice of the upper-level decision maker. For each individual, the linear programming formulation of the lower level problem is considered and its exact optimum solution is obtained in a very efficient way. Numerical experiments with instances of configurations derived from the Brazilian power system demonstrate the quality of the results obtained by the proposed algorithm. An analysis of the results is also presented for a case study comparing strategic bids to cost-based bids.