import arcpy
import numpy as np
def randomFCSample(fc, fd='sample_fd', sample_field='OBJECTID', sample_pct=10):
"""Return a randomish sample of a feature class as a feature layer
Parameters:
fc (str): Input feature class to sample
fd (str): Name of output feature layer
sample_field (int): Numeric field to sample values from
sample_pct (float): Percentage of feature class to sample
Returns:
feature layer sample of input feature class
"""
count_class = arcpy.GetCount_management(fc)
count = int(count_class[0])
random_vals = np.random.choice(count, int(count*(sample_pct/100)))
arcpy.MakeFeatureLayer_management(fc,
fd + "_" + str(sample_pct) + 'pct',
sample_field + ' IN ' + str(tuple(random_vals))
)