title: Convert string to random but deterministically repeatable uniform probability
body: <p>How do I convert a string, e.g. a user ID plus salt, to a random looking but actually a deterministically repeatable uniform probability in the semi-open range [0.0, 1.0)? This <a href="https://en.wikipedia.org/wiki/Interval_(mathematics)#Terminology" rel="noreferrer">means</a> that the output is ≥ 0.0 and &lt; 1.0. The output distribution must be uniform irrespective of the input distribution. For example, if the input string is 'a3b2Foobar', the output probability could repeatably be 0.40341504.</p>
  
  <p>Cross-language and cross-platform algorithmic reproducibility is desirable. I'm inclined to use a hash function unless there is a better way. Here is what I have:</p>
  
  <pre><code>&gt;&gt;&gt; in_str = 'a3b2Foobar'
  &gt;&gt;&gt; (int(hashlib.sha256(in_str.encode()).hexdigest(), 16) % 1e8) / 1e8
  0.40341504
  </code></pre>
  
  <p>I'm using the latest stable Python 3. Please note that this question is similar but not exactly identical to the related question to <a href="https://stackoverflow.com/questions/41255711/convert-integer-to-a-random-but-deterministically-repeatable-choice">convert an integer to a random but deterministically repeatable choice</a>.</p>