Simulating random graphs with tunable clustering is non-trivial.
One method is that described by Newman.
As you say there are various (conflicting) definitions of 'clustering coefficient'. Check the paper and see if it corresponds to yours. In any case you will need to compute an appropriate 'triangle corner' distribution.
Then to simulate the graph with $n$ vertices (which we label from $1$ to $n$):
- Generate a sequence of independent random variables $D_1, \dots, D_n$ according to your target degree distribution. If the sum of the $D_i$ is odd then add $1$ to $D_1$, say. Now attach $D_i$ 'half-edges', or 'stubs' to vertex $i$. Pair up the half-edges/stubs uniformly.
- Generate a sequence of independent random variables $T_1, \dots, T_n$ according to the triangle distribution. Adjust $T_1$ appropriately so that the $T_i$ sum to a multiple of $3$. Attach $T_i$ 'triangle corners' to vertex $i$, and repeatedly join $3$ corners together at random, till there are none remaining.
- You have now generated a 'multigraph'– possibly there are multiple edges and loops. Keep repeating (1)–(2) until you obtain a genuine graph.
This is fairly greedy. It generates a random graph which matches your degree distributions and clustering coefficients. However, it may or may not be a good model for your data.
Edit: the above method is also discussed by Wang along with an alternative.