diff liboctave/oct-rand.cc @ 10709:92a85ed5b86e

Don't special case color_property type when emitting factory default (bug #30118)
author David Bateman <dbateman@free.fr>
date Wed, 16 Jun 2010 23:27:58 +0200
parents 12884915a8e4
children fd0a3ac60b0e
line wrap: on
line diff
--- a/liboctave/oct-rand.cc	Wed Jun 16 14:36:23 2010 +0200
+++ b/liboctave/oct-rand.cc	Wed Jun 16 23:27:58 2010 +0200
@@ -165,6 +165,13 @@
   F77_FUNC (setsd, SETSD) (i0, i1);
 }
 
+void
+octave_rand::do_reset (void)
+{
+  use_old_generators = true;
+  initialize_ranlib_generators ();
+}
+
 ColumnVector
 octave_rand::do_state (const std::string& d)
 {
@@ -193,6 +200,27 @@
     rand_states[old_dist] = saved_state;
 }
 
+void
+octave_rand::do_reset (const std::string& d)
+{
+  use_old_generators = false;
+
+  int old_dist = current_distribution;
+
+  int new_dist = d.empty () ? current_distribution : get_dist_id (d);
+
+  ColumnVector saved_state;
+
+  if (old_dist != new_dist)
+    saved_state = get_internal_state ();
+
+  oct_init_by_entropy ();
+  rand_states[new_dist] = get_internal_state ();
+
+  if (old_dist != new_dist)
+    rand_states[old_dist] = saved_state;
+}
+
 std::string
 octave_rand::do_distribution (void)
 {