<｜begin▁of▁sentence｜>### Instruction:
Given a requirement to create a random graph with 10 nodes where each edge has a 50% chance of being created, how can you generate and visualize such a graph using the gnp_random_graph function from the NetworkX library?
### Response:
import networkx as nx
import matplotlib.pyplot as plt

# Generate a G_{n,p} random graph with n=10 nodes and p=0.5 probability of edge creation
n = 10
p = 0.5
G = nx.gnp_random_graph(n, p, seed=None, directed=False)

# Draw the graph using matplotlib
nx.draw(G, with_labels=True)
plt.show()
<|EOT|>
