<p>I'd like to get <strong>uniform distribution</strong> in range [0.0, 1.0)</p>

<p>If possible, please let the implementation make use of random bytes from <strong>/dev/urandom.</strong></p>

<p>It would also be nice if your solution was <strong>thread-safe</strong>. If you're not sure, please indicate that.</p>

<p>See <a href="https://stackoverflow.com/questions/146387#149814">some solution</a> I thought about after reading other answers.</p>

```
```
#include <stdlib.h>
printf("%f\n", drand48());
```
```
/dev/random:
```
```
double c;
fd = open("/dev/random", O_RDONLY);
unsigned int a, b;
read(fd, &a, sizeof(a));
read(fd, &b, sizeof(b));
if (a > b)
   c = fabs((double)b / (double)a);
else
    c = fabs((double)a / (double)b);
```
```
c is your random value