changeset 25245:9b93b85459da stable

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.
author Rik <rik@octave.org>
date Sat, 14 Apr 2018 05:16:29 -0700
parents f9fe8cf64e09
children b20d0736f322
files libinterp/corefcn/bsxfun.cc
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
 %!