Trying to divide the cardinality of a string/hash field by the numeric value of another field

I'm trying to create a runtime field within an index template. I can easily divide the values of two integers like this:

emit(doc['bounce_time'].value / doc['session'].value)

EG
bounce_time: 100 / session: 25 = 4

However I have a hash field that is essentially a uuid. Instead of dividing the bounce_time by the session Id like to divide the bounce_time by the cardinality of the field uuid: emit(doc['bounce_time'].value / doc['uuid'].value).

I'm not entirely sure how to get the cardinality of the uuid string field before doing the division. Any help?

Thanks

Just pinging this