Running into a Syntax error converting from JS to C#

I’ve looked and saw various answers on this topic and none seem to work for me. I’m using the incorrect syntax when writing this line of code in c#

newStructure.transform.localEulerAngles.y = (Random.Range(0,360));

Whenever I try to do a new Vector3 it gives me errors as well. What is the proper syntax for a problem like this?

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);