In electrolysis it is not necessary.
but in electroplating it is necessary.
for electroplating We need two electrodes made from different conducting materials, an electrolyte, and an electricity supply. Generally, one of the electrodes is made from the metal we're trying to plate and the electrolyte is a solution of a salt of the same metal.Then only we can do the process electroplating.
So, for example, if we're copper plating some brass, we need a copper electrode, a brass electrode, and a solution of a copper-based compound such as copper sulfate solution.