机器学习随机森林模型,用RandomizedSearchCV扫参为什么每次运行的结果不一样

问题遇到的现象和发生背景

用RandomizedSearchCV想给n_estimators扫一个参数,但是设置啥的都没有变,为什么每次运行的结果扫出来的最佳参数结果不一样

问题相关代码,请勿粘贴截图

from sklearn.model_selection import RandomizedSearchCV
#树的个数
n_estimators = [int(x) for x in range(10, 1000, 10)]
#bootstrap = [True, False]
#max_depth = [int(x) for x in range(10, 100, 10)]
param_random = {
'n_estimators': n_estimators,
}

rf = RandomForestClassifier()
rf_random = RandomizedSearchCV(estimator=rf, param_distributions=param_random, cv=5, verbose=2,#输出每一行的记录
random_state=42)
rf_random.fit(X,y)

获得最好的训练模型

best_estimator = rf_random.best_estimator_

定义用于计算误差和准确度的函数

def Calculation_accuracy(estimator, test_x, test_y):
pre_y = estimator.predict(test_x)
error = abs(pre_y - test_y).mean()
accuraccy = ((1 - abs(pre_y - test_y)/test_y)*100).mean()
return error, accuraccy

计算损失值和准确度

error, accuraccy = Calculation_accuracy(best_estimator,X,y)
print(error, accuraccy)

打印最好的参数组合

print(rf_random.best_params_)

运行结果及报错内容

我的解答思路和尝试过的方法

我想要达到的结果

想要让每次得到的结果一样