I have a feature class which contains features classified by type. What I would like to do in my new field is generate a random number sequence for those like values using a count of the like values. Perhaps the example below better illustrates my question:
Field1 Field2
X random # between 1&4
X random # between 1&4
X random # between 1&4
X random # between 1&4
Y random # between 1&2
Y random # between 1&2
Z random # between 1&3
Z random # between 1&3
Z random # between 1&3
I'm thinking I would just use GetCount for the totals and then random.randint(1, GetCount Value) to populate the new field. What I can't seem to figure out is how to have the count reset itself each time it encounters a new value. Thanks for any help you can offer.
Field1
each of the integers from 1 though the number of records with that value will appear exactly once. Note that since they are to be selected without replacement,randint
will not work.randint
. Should we therefore understand that in the present question you want to sample with replacement? That will generally result in some tied values and gaps among the random values assigned to each instance ofField1
.