# Why VonMisesFisher doesn't work for k = 0?

**URL:** <https://discourse.julialang.org/t/why-vonmisesfisher-doesnt-work-for-k-0/121595>\
**Category:** New to Julia\
**Tags:** question, distributions\
**Created:** [October 22, 2024, 2:45pm UTC](https://discourse.julialang.org/t/why-vonmisesfisher-doesnt-work-for-k-0/121595 "2024-10-22T14:45:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sahil\_Khan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sahil_khan/32/47573_2.png) [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Post date:** [October 22, 2024, 2:45pm UTC](https://discourse.julialang.org/t/why-vonmisesfisher-doesnt-work-for-k-0/121595/1 "2024-10-22T14:45:08Z")

</div>

Hello everyone, I was planning to use VonMisesFisher distribution for some modelling purpose like random walk. But when I tried to sample vectors for k=0 which should be giving values following uniform distribution, function gives error.

Is there some other function for uniform sphere distribution?

```julia
ERROR: κ must be positive.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] VonMisesFisher{Float64}(μ::Vector{Float64}, κ::Float64; checknorm::Bool)
   @ Distributions ~/.julia/packages/Distributions/uuqsE/src/multivariate/vonmisesfisher.jl:24
 [3] VonMisesFisher
   @ ~/.julia/packages/Distributions/uuqsE/src/multivariate/vonmisesfisher.jl:20 [inlined]
 [4] VonMisesFisher
   @ ~/.julia/packages/Distributions/uuqsE/src/multivariate/vonmisesfisher.jl:31 [inlined]
 [5] VonMisesFisher(μ::Vector{Float64}, κ::Int64)
   @ Distributions ~/.julia/packages/Distributions/uuqsE/src/multivariate/vonmisesfisher.jl:34
 [6] top-level scope
   @ REPL[38]:1

```

---

<div class="post-metadata">

**Author:** ![simsurace](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simsurace/32/30216_2.png) [@simsurace](https://discourse.julialang.org/u/simsurace)\
**Post date:** [October 22, 2024, 7:02pm UTC](https://discourse.julialang.org/t/why-vonmisesfisher-doesnt-work-for-k-0/121595/2 "2024-10-22T19:02:47Z")

</div>

I can‘t answer the why, but AFAIK this isn‘t the only distribution in Distributions.jl that is not defined on the boundary of the parameter space despite the fact that it would be a well-defined distribution.

The easiest way to generate uniform samples on the sphere is to normalize samples from the standard multivariate normal distribution.
