# HG changeset patch # User Rik # Date 1523708189 25200 # Node ID 9b93b85459daf995f503a586010f59742692a7db # Parent f9fe8cf64e096a86c8ebf1eb43806d3e671b39eb Set a known random seed so bsxfun BIST tests pass (bug #53636). * bsxfun.cc: Set the rand and randn states before running BIST tests, and restore the random number generation states after the tests are complete. diff -r f9fe8cf64e09 -r 9b93b85459da libinterp/corefcn/bsxfun.cc --- a/libinterp/corefcn/bsxfun.cc Fri Apr 13 12:39:08 2018 -0700 +++ b/libinterp/corefcn/bsxfun.cc Sat Apr 14 05:16:29 2018 -0700 @@ -721,6 +721,10 @@ %!assert (bsxfun (f, ones ([4, 1, 4, 1]), ones ([1, 4, 1, 4])), zeros ([4, 4, 4, 4])) %!shared a, b, aa, bb +%! ## FIXME: Set a known "good" random seed. See bug #51779. +%! old_nstate = randn ("state"); +%! restore_nstate = onCleanup (@() randn ("state", old_nstate)); +%! randn ("state", 42); # initialize generator to make behavior reproducible %! a = randn (3, 1, 3); %! aa = a(:, ones (1, 3), :, ones (1, 3)); %! b = randn (1, 3, 3, 3); @@ -754,6 +758,11 @@ %! int_types = {@int8, @int16, @int32, @int64, ... %! @uint8, @uint16, @uint32, @uint64}; %! +%! ## FIXME: Set a known "good" random seed. See bug #51779. +%! old_state = rand ("state"); +%! restore_state = onCleanup (@() rand ("state", old_state)); +%! rand ("state", 42); # initialize generator to make behavior reproducible +%! %! x = rand (3) * 10-5; %! y = rand (3,1) * 10-5; %!