  We consider synchronous distributed systems in which anonymous processors
communicate by shared read-write variables. The goal is to have all the
processors assign unique names to themselves. We consider the instances of this
problem determined by whether the number $n$ is known or not, and whether
concurrently attempting to write distinct values into the same memory cell is
allowed or not, and whether the number of shared variables is a constant
independent of $n$ or it is unbounded. For known $n$, we give Las Vegas
algorithms that operate in the optimum expected time, as determined by the
amount of available shared memory, and use the optimum $O(n\log n)$ expected
number of random bits. For unknown $n$, we give Monte Carlo algorithms that
produce correct output upon termination with probabilities that are
$1-n^{-\Omega(1)}$, which is best possible when terminating almost surely and
using $O(n\log n)$ random bits.
