How to keep random generators fixed in python?
<p>I have a code to assign a tag to each node in my network randomly either 'up' or 'down'.</p>

<p>How I can fix this random tags for later on so that they won't change if I run my codes each time?</p>

<pre><code>import networkx
import random

def assign_nodes(G):
    state = ['up','down']
    for n in G:
        G.node[n]['sign']=random.choice(state)
if __name__ =='__main__':
    input_data = open("data_test.txt",'r')
    graph = read_graph(input_data)
    assign_nodes(graph)
</code></pre>
