Mercurial > octave-nkf
comparison liboctave/oct-rand.cc @ 11663:3f5a67e8215c release-3-0-x
oct-rand.cc (get_dist_id): initialize retval
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 Feb 2008 18:46:14 -0500 |
parents | a4d0680f4dda |
children | 4dda6fbc8ba6 |
comparison
equal
deleted
inserted
replaced
11662:a4d0680f4dda | 11663:3f5a67e8215c |
---|---|
37 #include "randmtzig.h" | 37 #include "randmtzig.h" |
38 #include "randpoisson.h" | 38 #include "randpoisson.h" |
39 #include "randgamma.h" | 39 #include "randgamma.h" |
40 #include "mach-info.h" | 40 #include "mach-info.h" |
41 | 41 |
42 // Possible distributions of random numbers. This was handled with an | 42 static const int unknown_dist = 0; |
43 // enum, but unwind_protecting that doesn't work so well. | 43 static const int uniform_dist = 1; |
44 #define uniform_dist 1 | 44 static const int normal_dist = 2; |
45 #define normal_dist 2 | 45 static const int expon_dist = 3; |
46 #define expon_dist 3 | 46 static const int poisson_dist = 4; |
47 #define poisson_dist 4 | 47 static const int gamma_dist = 5; |
48 #define gamma_dist 5 | |
49 | 48 |
50 // Current distribution of random numbers. | 49 // Current distribution of random numbers. |
51 static int current_distribution = uniform_dist; | 50 static int current_distribution = uniform_dist; |
52 | 51 |
53 // Has the seed/state been set yet? | 52 // Has the seed/state been set yet? |
186 } | 185 } |
187 | 186 |
188 static int | 187 static int |
189 get_dist_id (const std::string& d) | 188 get_dist_id (const std::string& d) |
190 { | 189 { |
191 int retval; | 190 int retval = unknown_dist; |
192 | 191 |
193 if (d == "uniform" || d == "rand") | 192 if (d == "uniform" || d == "rand") |
194 retval = uniform_dist; | 193 retval = uniform_dist; |
195 else if (d == "normal" || d == "randn") | 194 else if (d == "normal" || d == "randn") |
196 retval = normal_dist; | 195 retval = normal_dist; |