srand time error uint/long

number putimalitze at gmx.de
Mon Apr 29 14:36:49 UTC 2019


How to call srand() with time()?

```
void main()
{
     import core.stdc.stdlib : rand, srand;
     import core.stdc.time : time;
     srand(time(null));
}
```

Error: function core.stdc.stdlib.srand(uint seed) is not callable 
using argument types (long)
cannot pass argument time(null) of type long to parameter uint 
seed

https://run.dlang.io/is/ner0Lx


And how to use the d libs instead? is this the way to go?

```
Random rnd = Random(Clock.currTime().second);
uniform01(rnd); //(or whatever)
```


More information about the Digitalmars-d-learn mailing list