You don’t modify the individual coordinates of a transform’s Vector3 (let it be a position, euler angles, etc), instead create a new one, modify it and then assign:
Vector3 v = new Vector3(someValue, Random.Range(0,360), someValue);
newStructure.transform.localEulerAngles = v;
or of course do it right away (AndyMartin’s answer)
If you thought that was long, you could this instead (same effect):
newStructure.transform.localEulerAngles -= new Vector3(
0,
newStructure.transform.localEulerAngles.y + Random.Range(0,360),
0);