什么是伪随机序列

  import numpy as np

  import matplotlib.pyplot as plt

  #用来正常显示中文标签

  #plt.rcParams['font.family'] = ['Simhei']

  plt.rcParams['font.sans-serif'] = ['Yahei consolas hybrid']

  #用来正常显示负号

  plt.rcParams['axes.unicode_minus']=False

  #

  A = 6

  N = 200

  x0 = 1

  M = 255

  v = np.zeros([N,1])

  #print(v)

  x= np.arange(N)

  for k in np.arange(N):

  x2 = A*x0

  x1 = x2 % M

  v1 = x1/256

  v[k] = 2*(v1 - 0.5)

  x0 = x1

  #print(v.reshape(7,16))

  plt.plot(x,v)

  plt.xlabel('k')

  plt.ylabel('v')

  plt.title('伪随机序列')

  plt.show()登录后复制