Select random faces but no adjacent faces
Another bmesh script

Similarly to @gorgeous
import bpy
import bmesh
from random import choice 

context = bpy.context
ob = context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)

ratio = 0.5
for f in bm.faces:
    f.select_set(False)
    
faces = set(bm.faces)
chosen = 0

while faces and (chosen / len(bm.faces)) &lt; ratio:
    face = choice(list(faces))
    face.select_set(True)
    faces -= set(f for v in face.verts for f in v.link_faces)
    chosen += 1
    
bmesh.update_edit_mesh(me)