<p dir="auto">I believe this is a bug, or if it isn't, I couldn't find anything in the documentation that says it should act this way.</p>
<p dir="auto">It seems like random.choice is ignoring the masked values. As you can see in the code below, the output of random.choice gives values that have been previously masked on the array.</p>
<h3 dir="auto">Reproducing code example:</h3>

<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
x = np.linspace(0,100,100)
xmask = np.ma.masked_where(x&gt;75,x)
print(np.nanmax(xmask))

random_choice = np.random.choice(xmask,50)
print(np.nanmax(random_choice))"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">0</span>,<span class="pl-c1">100</span>,<span class="pl-c1">100</span>)
<span class="pl-s1">xmask</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">ma</span>.<span class="pl-en">masked_where</span>(<span class="pl-s1">x</span><span class="pl-c1">&gt;</span><span class="pl-c1">75</span>,<span class="pl-s1">x</span>)
<span class="pl-en">print</span>(<span class="pl-s1">np</span>.<span class="pl-en">nanmax</span>(<span class="pl-s1">xmask</span>))

<span class="pl-s1">random_choice</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">choice</span>(<span class="pl-s1">xmask</span>,<span class="pl-c1">50</span>)
<span class="pl-en">print</span>(<span class="pl-s1">np</span>.<span class="pl-en">nanmax</span>(<span class="pl-s1">random_choice</span>))</pre></div>
<p dir="auto">Output:</p>
<blockquote>
<p dir="auto">74.74747474747475<br>
96.96969696969697</p>
</blockquote>
<p dir="auto">I've tried this several times, and the maximum value of random_choice always seems to be between 90 and 100.</p>
<h3 dir="auto">Numpy/Python version information:</h3>

<p dir="auto">1.18.1 3.7.6 (default, Jan  8 2020, 19:59:22)<br>
[GCC 7.3.0]</p>
<p dir="auto">The subject says it all, but in case you missed it:  the function <code class="notranslate">numpy.show_config()</code> (an alias for <code class="notranslate">numpy.__config__.show()</code>) doesn't have a docstring, and it does not appear in the <a href="https://docs.scipy.org/doc/numpy/genindex.html#S" rel="nofollow">online docs</a>.</p>
<p dir="auto">A docstring that explains the information printed by <code class="notranslate">show_config()</code> would be helpful.</p>