rand('seed', 0); rand('state', 1); rand('twister', 2); randn('seed', 3); randn('state', 4); rand_resetter = make_rand_resetter(); aa = rand; bb = randn; rand('seed'); cc = rand; rand('state'); dd = rand; randn('seed'); ee = randn; rand('seed', 0); rand('state', 1); rand('twister', 2); randn('seed', 3); randn('state', 4); aa2 = rand; bb2 = randn; rand('seed'); cc2 = rand; rand('state'); dd2 = rand; randn('seed'); ee2 = randn; rand_resetter(); aa3 = rand; bb3 = randn; rand('seed'); cc3 = rand; rand('state'); dd3 = rand; randn('seed'); ee3 = randn; testequal([aa, bb, cc, dd, ee], [aa2, bb2, cc2, dd2, ee2]); testequal([aa, bb, cc, dd, ee], [aa3, bb3, cc3, dd3, ee3]);