Not strictly an answer to your question, but..
To get a random value per face to be read by Cycles, you could use an adaptation
of Chebhou's answer to this question.
Run this script on the active object:
obj = bpy.context.object
obj_data = obj.data
group_name = 'face_ID'
#check for existing group with the same name
if None == obj_data.vertex_colors.get(group_name):
color_map = obj_data.vertex_colors[group_name]
for poly in obj_data.polygons:
color = (rnd, rnd, rnd,0)
for loop_ind in poly.loop_indices:
color_map.data[loop_ind].color = color
and then use the Cycles 'Attribute' node to retrieve the generated vertex color layer by name:
result of this example on a subdivided plane:
I've moved the randomization into the script - I was having trouble getting a good pseudo-random number out of a 0.0-1.0 input range using nodes. If nobody points out something obvious in a comment, I'll post that as another question.