Note that there are some explanatory texts on larger screens.

plurals
  1. POPicking a bounded uniform random value in GF(2^M) without exponentiation or tables
    primarykey
    data
    text
    <p>I am looking for a way to uniformly choose values in GF(2^M) between two bounds. </p> <p>GF(2^M) is a Galois Field - See GF(4) as defined on this page - <a href="http://www.math.umbc.edu/~campbell/Math413Spr09/Notes/12-13_Finite_Fields.html" rel="nofollow noreferrer">http://www.math.umbc.edu/~campbell/Math413Spr09/Notes/12-13_Finite_Fields.html</a><br> From a technical, non-math perspective, this is most similar to CRC operations. </p> <p>For example: </p> <pre><code>ulong gf2step( ulong x, int bits, ulong p ) { x = x &lt;&lt; 1; // "multiply" by x if ( x &gt;= (1 &lt;&lt; bits)) x = x ^ p; return x; } </code></pre> <p>Expanding the example from below:</p> <blockquote> <pre><code> 12 is '1100 '1100 shifted left by 1 becomes `11000. Since bit 4 is set, xor with `10011 (p). Next is `1011 or 11. </code></pre> </blockquote> <p>Similarly,</p> <blockquote> <pre><code> 9 is '1001 '1001 shifted left by 1 becomes `10010. Since bit 4 is set, xor with `10011 (p). Next is `0001. </code></pre> </blockquote> <p>My obvious method is to start with the integer exponents corresponding to the bounds, pick a random exponent between those and generate the value from that. </p> <p>However, this has two problems --<br> 1. Given arbitrary bounds, I can't find the corresponding integer exponent..<br> 2. This will be repeated many, many times, so I am concerned about exponentiation speed.</p> <p>Example: </p> <pre><code> int gf2random( ulong low, ulong high, ulong p); gf2random( 12, 13, 19) should return evenly from the set {12, 11,5,10,7,14,15, 13} gf2random( 9, 1, 19) should return either 9 or 1 </code></pre> <p>I can step the values in GF(2^M) fairly easily - but I'm not sure how to avoid overshooting the upper bound.</p> <p><hr /> Does it simplify the problem if the low bound was always '1' ? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload