You could sample a random number and index the embedding.weight directly via:
w = emb.weight[index]

Afterwards, you could calculate some score and reassign the new value to emb.weight[index].
I’m unsure, how the training works using random indices and skipping Autograd, so could you add a bit more information about your use case?