| 1 |
function reset_ini_seed(seednumber) |
| 2 |
%After Matlab starts, run this function to reset the seed number; otherwise, Matlab automatically resets to the same initial seed. |
| 3 |
% seednumber: 0 -- random state reset to the clock time; |
| 4 |
% |
| 5 |
% Copyright (C) 1997-2012 Tao Zha |
| 6 |
% |
| 7 |
% This free software: you can redistribute it and/or modify |
| 8 |
% it under the terms of the GNU General Public License as published by |
| 9 |
% the Free Software Foundation, either version 3 of the License, or |
| 10 |
% (at your option) any later version. |
| 11 |
% |
| 12 |
% It is distributed in the hope that it will be useful, |
| 13 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
% GNU General Public License for more details. |
| 16 |
% |
| 17 |
% If you did not received a copy of the GNU General Public License |
| 18 |
% with this software, see <http://www.gnu.org/licenses/>. |
| 19 |
% |
| 20 |
|
| 21 |
if seednumber |
| 22 |
randn('state',seednumber); |
| 23 |
rand('state',seednumber); |
| 24 |
else |
| 25 |
randn('state',fix(100*sum(clock))); |
| 26 |
rand('state',fix(100*sum(clock))); |
| 27 |
end |