本文整理汇总了C#中System.Random.NextInt64方法的典型用法代码示例。如果您正苦于以下问题:C# Random.NextInt64方法的具体用法?C# Random.NextInt64怎么用?C# Random.NextInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Random
的用法示例。
在下文中一共展示了Random.NextInt64方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateRandomAccountCollection
private EntityCollection GenerateRandomAccountCollection()
{
var collection = new List<Entity>();
for (var i = 0; i < 10; i++)
{
var rgn = new Random((int)DateTime.Now.Ticks);
var entity = new Entity("account");
entity["accountid"] = entity.Id = Guid.NewGuid();
entity["address1_addressid"] = Guid.NewGuid();
entity["modifiedon"] = DateTime.Now;
entity["lastusedincampaign"] = DateTime.Now;
entity["donotfax"] = rgn.NextBoolean();
entity["new_verybignumber"] = rgn.NextInt64();
entity["exchangerate"] = rgn.NextDecimal();
entity["address1_latitude"] = rgn.NextDouble();
entity["numberofemployees"] = rgn.NextInt32();
entity["primarycontactid"] = new EntityReference("contact", Guid.NewGuid());
entity["revenue"] = new Money(rgn.NextDecimal());
entity["ownerid"] = new EntityReference("systemuser", Guid.NewGuid());
entity["industrycode"] = new OptionSetValue(rgn.NextInt32());
entity["name"] = rgn.NextString(15);
entity["description"] = rgn.NextString(300);
entity["statecode"] = new OptionSetValue(rgn.NextInt32());
entity["statuscode"] = new OptionSetValue(rgn.NextInt32());
collection.Add(entity);
}
return new EntityCollection(collection);
}
示例2: TranspositionTable
public TranspositionTable()
{
tableContent = new HashObject[tableSize];
System.Random random = new System.Random(DateTime.Now.Millisecond);
List<Int64> generatedBefore = new List<Int64>();
turnPlayerA = random.NextInt64();
turnPlayerB = random.NextInt64();
playerAMax = random.NextInt64();
playerBMax = random.NextInt64();
generatedBefore.Add(turnPlayerA);
while (generatedBefore.Contains(turnPlayerB)) turnPlayerB = random.NextInt64();
generatedBefore.Add(turnPlayerB);
while (generatedBefore.Contains(playerAMax)) playerAMax = random.NextInt64();
generatedBefore.Add(playerAMax);
while (generatedBefore.Contains(playerBMax)) playerBMax = random.NextInt64();
generatedBefore.Add(playerBMax);
for (int x = 0; x < 21; x++)
{
for (int y = 0; y < 20; y++)
{
for (int n = 0; n < 6; n++)
{
Int64 randomValue = random.NextInt64();
while (generatedBefore.Contains(randomValue)) randomValue = random.NextInt64();
generatedBefore.Add(randomValue);
switch (n)
{
case 0:
emptySpacesKeys[x,y] = randomValue;
break;
case 1:
tilesKeys[x,y] = randomValue;
break;
case 2:
redTailKeys[x,y] = randomValue;
break;
case 3:
redheadKeys[x,y] = randomValue;
break;
case 4:
whiteTailKeys[x,y] = randomValue;
break;
case 5:
whiteHeadKeys[x, y] = randomValue;
break;
}
}
}
}
}
示例3: CanSampleInt64
public void CanSampleInt64()
{
var rnd = new Random();
rnd.NextInt64();
}