set random active face in python without toggle mode
Random active face

Please heed the advice given in comments above.  One of the (IMO) dopier rules on bse is the inability of new users to comment.

Noticed your deleted post here re Deselect Neighbours Faces

Here is a test script using method outlined in https://blender.stackexchange.com/a/81425/15543  Sets a random face active, and selects it.

import bpy
import bmesh
from random import randint

def random_face(bm):
    bm.faces.ensure_lookup_table()
    return bm.faces[randint(0, len(bm.faces) - 1)]

context = bpy.context
ob = context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)
print("before", bm.faces.active)
bm.faces.active = random_face(bm)
bm.faces.active.select = True
print("after", bm.faces.active)

bmesh.update_edit_mesh(me)


To also make the face the active select history

bm.select_history.add(bm.faces.active)
print(bm.select_history.active is bm.faces.active)