<｜begin▁of▁sentence｜>### Instruction:
{'description': "Given the histogram of values representing a discrete distribution, use NetworkX's discrete_sequence function to sample a sequence of a specified length from this distribution.", 'data': 'A histogram of values: [0.3, 0.4, 0.2, 0.1]', 'problem': 'How can you generate a random sequence of 10 elements where each element corresponds to an index with a probability defined in the histogram?'}
### Response:
import networkx as nx
from networkx.utils import discrete_sequence
# Given a histogram of values
histogram = [0.3, 0.4, 0.2, 0.1]
# Sample a sequence of length 10 from the given distribution
sequence = discrete_sequence(10, distribution=histogram)
print('Sampled sequence:', sequence)
<|EOT|>
