Conventional simulations of complex systems in the canonical ensemble suffer from the quasi-ergodicity problem. A simulation in generalized ensemble overcomes this difficulty by performing a random walk in potential energy space and other parameter space. From only one simulation run, one can obtain canonical-ensemble averages of physical quantities as functions of temperature by the single-histogram and/or multiple-histogram reweighting techniques. In this article, we review the generalized-ensemble algorithms. Three well-known methods, namely multicanonical algorithm, simulated tempering, and replica-exchange method, are described first. Both Monte Carlo and molecular dynamics versions of the algorithms are given. We then present further extensions of the above three methods.