| 129 | return randrange(10**(n-1), 10**n) |
| 130 | |
| 131 | def randtuple(maxprec, maxexp): |
| 132 | n = randrange(100) |
| 133 | sign = randrange(2) |
| 134 | coeff = ndigits(maxprec) |
| 135 | if n >= 95: |
| 136 | coeff = () |
| 137 | exp = 'F' |
| 138 | elif n >= 85: |
| 139 | coeff = tuple(map(int, str(ndigits(maxprec)))) |
| 140 | exp = "nN"[randrange(2)] |
| 141 | else: |
| 142 | coeff = tuple(map(int, str(ndigits(maxprec)))) |
| 143 | exp = randrange(-maxexp, maxexp) |
| 144 | return (sign, coeff, exp) |
| 145 | |
| 146 | def from_triple(sign, coeff, exp): |
| 147 | return ''.join((str(sign*coeff), indicator(), str(exp))) |