batch vs command windows rng

5 次查看(过去 30 天)
Julian Kozlowski
Julian Kozlowski 2020-10-7
Say we have the following simple script
% temp.m
clear; close all; clc
rng(1)
x = rand(1,1);
disp(x)
If we run this script on the command windows I get the answer x=0.4170
If I run the job as
batch('temp')
I get a different answer, x=0.1404
Moreover, if you don't fix the seed, then you get a different number for every run in the command windows, but always the same number on the server.
Any idea why is this happening? And how to fix it so command windows and batch generate the same answer?
Thanks!

回答(1 个)

Walter Roberson
Walter Roberson 2020-10-7

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by