I would like to generate a random network where the average degree is distributed around 4 and 10. So most of the nodes should either have a degree of 4 or degree 10.
Is this possible to do?
You could use the configuration model (Molly & Reed '98) to generate such a random graph. It's implemented in igraph (and certainly in other libraries), as described here.
The principle is the following. 1) you draw your degree distribution. 2) you generate a set of stubs, such that for each node, you have a number of stubs corresponding to its degree. So, a node with degree 10 will appear as 10 distinct stubs. 3) you randomly draw 2 stubs in this set, and connect them to create a new link. The previous node, whose degree is 10, will therefore be connected to 10 nodes, which is what we want. You repeat this step until all stubs are connected. Obviously, you need an even number of stubs.
Drawbacks are: possible multiple links (i.e. two nodes connected more than once) and self-links or loops (one node connected with itself). You can forbid these links during the generation process, but you might also not get exactly the targeted distribution. Also, you only control the degree distribution, and not the other topological properties, such as degree correlation or average distance.
So, with this model, you just need to be able to generate a bimodal distribution. You'll find easily how to, for instance (still using R) here.