本文整理汇总了C#中System.Numerics.BigInteger.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# BigInteger.GetHashCode方法的具体用法?C# BigInteger.GetHashCode怎么用?C# BigInteger.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Numerics.BigInteger
的用法示例。
在下文中一共展示了BigInteger.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateQuorums
public static List<SortedSet<int>> GenerateQuorums(SortedSet<int> parties, int quorumCount, int countPerQuorum, BigInteger seed)
{
// ensure that every party will be in a quorum
Debug.Assert(quorumCount * countPerQuorum >= parties.Count);
List<SortedSet<int>> quorums = new List<SortedSet<int>>();
int intSeed = seed.GetHashCode();
// Random randGen = new Random(intSeed);
Random randGen = new Random(3);
Dictionary<int, int> partyPositions = new Dictionary<int, int>();
int pos = 0;
foreach (int party in parties)
partyPositions[pos++] = party;
do
{
quorums.Clear();
for (int i = 0; i < quorumCount; i++)
{
quorums.Add(GenerateQuorum(randGen, countPerQuorum, parties.Count, partyPositions));
}
} while (!AreAllInQuorum(quorums, parties.Count));
return quorums;
}
示例2: ChainedBlock
public ChainedBlock(UInt256 blockHash, UInt256 previousBlockHash, int height, BigInteger totalWork)
{
this._blockHash = blockHash;
this._previousBlockHash = previousBlockHash;
this._height = height;
this._totalWork = totalWork;
this.hashCode = blockHash.GetHashCode() ^ previousBlockHash.GetHashCode() ^ height.GetHashCode() ^ totalWork.GetHashCode();
}
示例3: DefaultCtorWorks
public void DefaultCtorWorks ()
{
var a = new BigInteger ();
Assert.AreEqual (BigInteger.One, ++a, "#1");
a = new BigInteger ();
Assert.AreEqual (BigInteger.MinusOne, --a, "#2");
a = new BigInteger ();
Assert.AreEqual (BigInteger.MinusOne, ~a, "#3");
a = new BigInteger ();
Assert.AreEqual ("0", a.ToString (), "#4");
a = new BigInteger ();
Assert.AreEqual (true, a == a, "#5");
a = new BigInteger ();
Assert.AreEqual (false, a < a, "#6");
a = new BigInteger ();
Assert.AreEqual (true, a < 10l, "#7");
a = new BigInteger ();
Assert.AreEqual (true, a.IsEven, "#8");
a = new BigInteger ();
Assert.AreEqual (0, (int)a, "#9");
a = new BigInteger ();
Assert.AreEqual (0, (uint)a, "#10");
a = new BigInteger ();
Assert.AreEqual (0, (ulong)a, "#11");
a = new BigInteger ();
Assert.AreEqual (true, a.Equals (a), "#12");
a = new BigInteger ();
Assert.AreEqual (a, BigInteger.Min (a, a), "#13");
a = new BigInteger ();
Assert.AreEqual (a, BigInteger.GreatestCommonDivisor (a, a), "#14");
a = new BigInteger ();
Assert.AreEqual (BigInteger.Zero.GetHashCode (), a.GetHashCode (), "#15");
}