In many domains it is necessary to generate surrogate networks, e.g., for hypothesis testing of different properties of a network. Furthermore, generating surrogate networks typically requires that different properties of the network is preserved, e.g., edges may not be added or deleted and the edge weights may be restricted to certain intervals. In this paper we introduce a novel efficient property-preserving Markov Chain Monte Carlo method termed CycleSampler for generating surrogate networks in which (i) edge weights are constrained to an interval and node weights are preserved exactly, and (ii) edge and node weights are both constrained to intervals. These two types of constraints cover a wide variety of practical use-cases. The method is applicable to both undirected and directed graphs. We empirically demonstrate the efficiency of the CycleSampler method on real-world datasets. We provide an implementation of CycleSampler in R, with parts implemented in C.