The idea is that the graph is acyclical if and only if there is an ordering of vertices that makes the adjacency matrix inferior triangular¹. It is easy to see that if the adjacency matrix is lower triangular, the vertex $ i $ can only point to the vertex $ j $ if $ i <j $.

Then we generate a matrix that has zeros and ones evenly distributed under the diagonal:

```
vertexCount = 10;
edgeCount = 30;
elems = RandomSample @
PadRight[ConstantArray[1, edgeCount],
vertexCount (vertexCount - 1) / 2]adjacencyMatrix =
Drink[
FoldList[RotateLeft, elems, Range[0, vertexCount - 2]],
Everyone,
vertexCount
]~ Triangularize lower ~ -1
```

(Thanks to @ Mr.Wizard for the code that fills the triangular matrix!)

```
graph = AdjacencyGraph[adjacencyMatrix]
AcyclicGraphQ[graph]
(* ==> True *)
```

`LayeredGraphPlot`

will show you the acyclic structure in a "convincing" way:

He did not say it explicitly, but I guess he needs a connected graphic. Unfortunately I do not have an algorithm that gives you a connected one, but you can continue generating them until you find one connected by accident (brute force). If the connectivity is very low and you get very few connected, you can try to generate graphics with a vertex count slightly higher than required until the largest connected component has the required vertex count.

Packed in a function for convenience:

```
randomDAG[vertexCount_, edgeCount_] /;
edgeCount <vertexCount (vertexCount - 1) / 2: =
Module
The
{elems, adjacencyMatrix},
elems = RandomSample @
PadRight[ConstantArray[1, edgeCount], vertexCount (vertexCount - 1) / 2];
adjacencyMatrix =
Drink[
FoldList[RotateLeft, elems, Range[0, vertexCount - 2]],
Everyone,
vertexCount
]~ Triangularize lower ~ -1;
AdjacencyGraph[adjacencyMatrix]
]
```

¹ You can find the order that makes the adjacency matrix triangular using a topological arrangement.