Generate a list of Python Decimals with *none_prob* probability of an entry being None (or NaN if *use_nan* is true).
(self, n, none_prob=DEFAULT_NONE_PROB,
use_nan=False)
| 156 | return data |
| 157 | |
| 158 | def generate_decimal_list(self, n, none_prob=DEFAULT_NONE_PROB, |
| 159 | use_nan=False): |
| 160 | """ |
| 161 | Generate a list of Python Decimals with *none_prob* probability of |
| 162 | an entry being None (or NaN if *use_nan* is true). |
| 163 | """ |
| 164 | data = [decimal.Decimal('%.9f' % f) |
| 165 | for f in self.rnd.uniform(0.0, 1.0, n)] |
| 166 | assert len(data) == n |
| 167 | self.sprinkle(data, none_prob, |
| 168 | value=decimal.Decimal('nan') if use_nan else None) |
| 169 | return data |
| 170 | |
| 171 | def generate_object_list(self, n, none_prob=DEFAULT_NONE_PROB): |
| 172 | """ |