Looks like the cutoff is 5 digits to the right of the decimal:

```
$ php -r 'print (float)2.1E-6;'

2.1E-6
$ php -r 'print (float)2.1E-5;'
2.1E-5
$ php -r 'print (float)2.1E-4;'
0.00021

```

So maybe we can dial down Random::percent()'s significant digits?



On Tue, Jun 25, 2013 at 10:07 AM, Shad Laws <notifications@github.com>wrote:

> In modules/gallery/classes/Gallery/Model/Item.php:
>
> > @@ -27,7 +27,7 @@ public function __construct($id=null) {
> >      if (!$this->loaded()) {
> >        // Set reasonable defaults
> >        $this->created = time();
> > -      $this->rand_key = Random::percent();
> > +      $this->rand_key = sprintf("%f", Random::percent());  // sprintf to prevent things like 2.1E-6
>
> I thought about that, but wasn't entirely sure. In effect, we're changing
> the return value from a number to a string. If nobody cares about that,
> then I'm in :-)
>
> I'm a bit surprised we've never seen this pop up before... I realize it's
> a rare occurrence, but I've *never* seen this before a unit test failed
> earlier today.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/gallery/gallery3/pull/430/files#r4871500>
> .
>