This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
cs-312:randombigintegers [2015/01/31 11:56] cs312ta |
cs-312:randombigintegers [2015/01/31 11:59] (current) cs312ta |
||
---|---|---|---|
Line 16: | Line 16: | ||
rand.NextBytes(data); | rand.NextBytes(data); | ||
result = new BigInteger(data); | result = new BigInteger(data); | ||
- | } while (result >= N || result < 0); | + | } while (result >= N || result <= 0); |
return result; | return result; | ||
} | } | ||
Line 39: | Line 39: | ||
== Interactive Visualization / Example in C# == | == Interactive Visualization / Example in C# == | ||
We have made a program that has both methods of generating BigIntegers and draws the distribution of the randomly generated numbers. In the program you can select "mod" to see BigIntegers generated by simply modding, and then by selecting "repeat" you will see the distribution when the random code is repeated until a number in the desired range is obtained. It also shows you the time required to generate all the numbers so you can get a sense for the difference in performance. | We have made a program that has both methods of generating BigIntegers and draws the distribution of the randomly generated numbers. In the program you can select "mod" to see BigIntegers generated by simply modding, and then by selecting "repeat" you will see the distribution when the random code is repeated until a number in the desired range is obtained. It also shows you the time required to generate all the numbers so you can get a sense for the difference in performance. | ||
- | {{:cs-312:randombigintegers.zip|}} | + | {{:cs-312:randombigintegers.zip|RandomBigIntegers Project}} |
+ | [http://wiki.cs.byu.edu/_media/cs-312/randombigintegers.zip Download RandomBigIntegers C# Project] |