Generating random graphs with certain properties