# HG changeset patch # User Rik # Date 1562986503 25200 # Node ID 84cdeeaf0dce5862bdce797cfec515241fb880ba # Parent a23f25cc2aae978d1dd41cd442652aa7404953fa Accept only integers for single input form of rand (bug #56609). * rand.cc: Use idx_type_value(true) rather than double_value() to convert input octave_value to integer size of output array. diff -r a23f25cc2aae -r 84cdeeaf0dce libinterp/corefcn/rand.cc --- a/libinterp/corefcn/rand.cc Fri Jul 12 17:20:07 2019 -0700 +++ b/libinterp/corefcn/rand.cc Fri Jul 12 19:55:03 2019 -0700 @@ -170,14 +170,11 @@ } else if (tmp.is_scalar_type ()) { - double dval = tmp.double_value (); - - if (octave::math::isnan (dval)) - error ("%s: NaN is invalid matrix dimension", fcn); + octave_idx_type n = tmp.idx_type_value (true); dims.resize (2); - dims(0) = dims(1) = octave::math::nint_big (dval); + dims(0) = dims(1) = n; goto gen_matrix; }