当前位置: 首页>>代码示例>>C#>>正文


C# Random.NextInt64方法代码示例

本文整理汇总了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);
        }
开发者ID:guusvanw,项目名称:Guus.Xrm,代码行数:29,代码来源:GenericXrmServiceTest.cs

示例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;
                        }
                    }
                }
            }
        }
开发者ID:theplaymate,项目名称:windespacman,代码行数:55,代码来源:TranspositionTable.cs

示例3: CanSampleInt64

 public void CanSampleInt64()
 {
     var rnd = new Random();
     rnd.NextInt64();
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:5,代码来源:SystemRandomExtensionTests.cs


注:本文中的System.Random.NextInt64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。