### generate random elliptic curve of prime order

As required in many cryptographic algorithms, I would like to sample a group (in this case, an abelian group defined on elliptic curve) of a random prime order. I know how to define an elliptic curve with given parameters, and then calculate its order. But how to sample an elliptic curve of random prime order?