function [] = tryrff_v2_function_for_each_sim(gamma, trnwin, iSim, stdize)
%**************************************************************************
% The function computes OOS performance with one random seed.
% Parameters:
% gamma: gamma in Random Fourier Features
% trnwin: training window
% iSim: random seed for this simulation
% stdize: Standardization. stdize = 1 means True
%**************************************************************************
tic
nSim = 1; % total number of simulations run in this function
%**************************************************************************
% Choices
%**************************************************************************
% max number of Random Fourier Features (RFFs)
maxP = 12000;
% the grid of RFFs number
Plist = [2 5:floor(trnwin/10):(trnwin-5) (trnwin-4):2:(trnwin+4) (trnwin+5):floor(trnwin/2):30*trnwin (31*trnwin):(10*trnwin):(maxP-1) maxP];
% training frequency
trainfrq= 1;
% shrinkage parameters lambda (z)
log_lamlist = [-3:1:3];
lamlist = 10.^(log_lamlist);
% save the result
saveon = 1;
% Demeaning = False
demean = 0;
% length of shrinkage parameters
nL = length(lamlist);
% length of RFFs number grid
nP = length(Plist);
% saving string
para_str = strcat('maxP-',