# rand(1:10) vs Int(round(10\*rand())

**URL:** <https://discourse.julialang.org/t/rand-1-10-vs-int-round-10-rand/14339>\
**Category:** Performance\
**Created:** [August 30, 2018, 11:01pm UTC](https://discourse.julialang.org/t/rand-1-10-vs-int-round-10-rand/14339 "2018-08-30T23:01:31Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![foobar\_lv2](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Post date:** [September 16, 2018, 11:15am UTC](https://discourse.julialang.org/t/rand-1-10-vs-int-round-10-rand/14339/17 "2018-09-16T11:15:27Z")

</div>

> [@y4lu](#):
>
> `*10^16` might be stretching the float 64 precision levels a bit, 70% integer numbers returned

```julia
julia> 10^16 == Float64(10^16)
true

```

The problem is that `rand(Float64)` effectively generates random fixed-point numbers and then converts them to floats. See [https://discourse.julialang.org/t/output-distribution-of-rand/12192](https://discourse.julialang.org/t/output-distribution-of-rand/12192).

---

_[View the full topic](https://discourse.julialang.org/t/rand-1-10-vs-int-round-10-rand/14339)._
