changeset 1332:14e4c2a741c6

[project @ 1995-08-24 05:02:41 by jwe]
author jwe
date Thu, 24 Aug 1995 05:02:41 +0000
parents c04c2a6849e8
children b3fb410592a6
files src/rand.cc
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/rand.cc	Thu Aug 24 01:35:58 1995 +0000
+++ b/src/rand.cc	Thu Aug 24 05:02:41 1995 +0000
@@ -213,8 +213,29 @@
 	}
       else if (tmp.is_matrix_type ())
 	{
+// XXX FIXME XXX -- this should probably use the function from data.cc.
+
+	  Matrix a = args(0).matrix_value ();
+
+	  if (error_state)
+	    return retval;
+
 	  n = args(0).rows ();
 	  m = args(0).columns ();
+
+	  if (n == 1 && m == 2)
+	    {
+	      n = NINT (a.elem (0, 0));
+	      m = NINT (a.elem (0, 1));
+	    }
+	  else if (n == 2 && m == 1)
+	    {
+	      n = NINT (a.elem (0, 0));
+	      m = NINT (a.elem (1, 0));
+	    }
+	  else
+	    warning ("rand (A): use rand (size (A)) instead");
+
 	  goto gen_matrix;
 	}
       else