Custom Attributes in Single Shading Switch

Hi, I am attempting to assign a random number to the vCoord of a ramp on my lambert1 shader specifically for hair strands.

My initial solution was to use an arbitrary attribute of the xform for example transMinusRotatePivotX to provide a pseudo-random seed which runs through a singleShadingSwitch into the vCoord of my ramp. This produces okay results and renders correctly in the viewport with hardware texturing. However it is not providing the diversity I was hoping for.

My second attempt was to give each strand’s xform a custom attribute with a random number from python. Then use that seed into the same singleShadingSwitch. This works and in Hypershade I can see the values are being passed correctly and the thumbnail renders with the custom vCoord. However in the viewport there are no changes, and the strands all use the same UVs for the ramp.

My assumption is that custom attributes do not work the way I had hoped. However here http://lukewalters.co.uk/coding/pymel/triple-shader-for-per-object-shading/ it appears that this user has it working. My implementation is very similar and whether I do this via python automation or manually in the Node Editor it does not work as expected.

Any ideas on why this wouldn’t be an acceptable solution or perhaps a more verbose approach?
Thanks!

I rewrote it and it works, not sure what happened.