Other meanings of Randomized algorithm
Computer science
A randomized algorithm employs randomization to influence its execution or output. Unlike a deterministic algorithm, it may follow different computational paths on identical input, allowing simpler designs, lower expected running time, approximate answers, or protection against adversarial input. Randomness can be supplied by a physical source, a pseudorandom generator, or a hybrid of both.
Randomized algorithms use random choices as part of their computational procedure, so one input can produce different execution traces on different runs.1 The randomness may select a pivot, sample data, choose a search path, or decide whether to repeat a test. Analysis therefore considers probability distributions over executions rather than one fixed sequence of operations.
Two broad classes organize the subject. A Las Vegas algorithm always returns a correct answer, while its running time or amount of work is random; randomized quicksort is a standard example. A Monte Carlo algorithm has a bounded or predictable running time but accepts a small probability of an incorrect answer. Error can often be reduced by independent repetition, although the cost and dependence between trials must be analyzed carefully.
Randomization is useful because it can make algorithms simpler, faster on average, and less vulnerable to unfavorable input arrangements. Randomized quicksort avoids the consistently poor pivot choices that can make a fixed pivot rule take quadratic time, achieving expected O(n log n) comparisons under common models.2 In streaming and sublinear algorithms, random samples or compact sketches estimate properties of data without reading or storing everything.
Randomness also helps defeat adversarial behavior. In online settings, an opponent that knows a deterministic policy can construct inputs against it, whereas a private random choice can make such prediction difficult. Randomized algorithms appear in cryptography, distributed computing, load balancing, geometric sampling, approximation algorithms, and randomized primality testing. Their guarantees may be stated as expected running time, high-probability success, or bounds that hold for every input while averaging only over internal random choices.
Analyzing a randomized algorithm requires specifying both the input model and the source of randomness. Expected performance over random inputs is not the same as performance guaranteed for every input, and an algorithm that is fast on average may still have rare, expensive executions. Tail bounds, concentration inequalities, and failure-probability calculations help distinguish a dependable high-probability guarantee from a merely favorable mean.
Practical implementations usually use pseudorandom number generators, whose deterministic output is designed to imitate random behavior. This makes experiments reproducible through a seed, but it does not automatically provide cryptographic security. Security-sensitive algorithms require carefully designed random or pseudorandom sources, because predictable choices can reveal keys or undermine protocols.3 Correlated, biased, or reused random values can likewise invalidate a proof that assumes independent samples.
Randomized algorithms have important middle ground between exact computation and pure approximation. Randomized rounding converts fractional solutions into discrete ones while preserving expected objective values, often yielding provable approximation guarantees for difficult optimization problems.4 Random walks support algorithms for graph connectivity, sampling, ranking, and estimating algebraic quantities; their behavior connects algorithm design with probability theory and Markov chains.
Randomness can also be removed in principle through derandomization, replacing random choices with carefully selected deterministic ones, though the resulting algorithm may be more complicated or slower. In complexity theory, randomized classes such as BPP formalize problems solvable with bounded error in polynomial time, and major results show that some apparently random advantages may be reproducible deterministically under additional assumptions. The field thus studies not only how to use randomness, but also when it is genuinely necessary.
Running-time and error claims depend on the stated computational model, independence assumptions, and quality of the random source.
Help improve the encyclopedia. Reports go straight to the site manager.