def update(): import arcpy, random mylist = [] x = 1 while x <= 16: mylist.append(x) x += 1 x = 1 rows = arcpy.UpdateCursor(r"C:\temp\python\test.gdb\Fires") for row in rows: y = random.choice(mylist) row.Sample = y val = row.Sample mylist.remove(y) del row, rows return val
import arcpy, random mylist = [] x = 1 while x <= 16: mylist.append(x) x += 1 rows = arcpy.UpdateCursor(r"C:\temp\python\test.gdb\Fires") for row in rows: y = random.choice(mylist) row.Random = y rows.updateRow(row) mylist.remove(y) del row, rows