Is it possible to have a function with the following properties?

(i) The function maps a bounded $n$-dimensional space $\mathcal{X}$ (say $\left[0,1\right]^n$) onto a bounded interval $\mathcal{Y}$ (say $\left[0,1\right]$);

(ii) The function has exactly $k$ minima in $X$, whose locations are distributed randomly, and whose vaues are distributed randomly over $\mathcal{Y}$. Ideally, the value of the global minimum (in $\mathcal{X}$) should correspond to the lowerbound of $\mathcal{Y}$.

Additional notes:

(i) It does not matter if the function has additional minima outside of $\mathcal{X}$;

(ii) The function does not need to be differentiable over $\mathcal{X}$: this means that the local minima could also be, for example, kinks;

(iii) The number of maxima in $\mathcal{X}$ does not matter;

(iv) It is also OK if the minima and maxima are interchanged (i.e. if the function has $k$ maxima and any number of minima).