# Random specific in julia

**URL:** <https://discourse.julialang.org/t/random-specific-in-julia/8397>\
**Category:** New to Julia\
**Created:** [January 16, 2018, 10:52am UTC](https://discourse.julialang.org/t/random-specific-in-julia/8397 "2018-01-16T10:52:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![1112](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/1112/32/9325_2.png) [@1112](https://discourse.julialang.org/u/1112)\
**Post date:** [January 16, 2018, 10:52am UTC](https://discourse.julialang.org/t/random-specific-in-julia/8397/1 "2018-01-16T10:52:53Z")

</div>

Is there a function in Julia that can generate a random integer in the range and without repeats?

---

<div class="post-metadata">

**Author:** ![anon61610682](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@anon61610682](https://discourse.julialang.org/u/anon61610682)\
**Post date:** [January 16, 2018, 10:56am UTC](https://discourse.julialang.org/t/random-specific-in-julia/8397/2 "2018-01-16T10:56:34Z")

</div>

Have you checked `?randperm` or `?shuffle`? Do they work for you?

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [January 16, 2018, 11:29am UTC](https://discourse.julialang.org/t/random-specific-in-julia/8397/3 "2018-01-16T11:29:23Z")

</div>

I’m not sure what you mean by “in the range” but `rand(1:10)` gives you an integer between (and including) 1 and 10.

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [January 16, 2018, 11:31am UTC](https://discourse.julialang.org/t/random-specific-in-julia/8397/4 "2018-01-16T11:31:01Z")

</div>

Sampling without replacement is probably what you are looking for. [http://juliastats.github.io/StatsBase.jl/stable/sampling.html#Sampling-from-Population-1](http://juliastats.github.io/StatsBase.jl/stable/sampling.html#Sampling-from-Population-1)
