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


C# Random.Substring方法代码示例

本文整理汇总了C#中System.Random.Substring方法的典型用法代码示例。如果您正苦于以下问题:C# Random.Substring方法的具体用法?C# Random.Substring怎么用?C# Random.Substring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Random的用法示例。


在下文中一共展示了Random.Substring方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetStatsForHorseJockeyCourse

        private static string GetStatsForHorseJockeyCourse(
            string horse,
            string jockey,
            string course)
        {
            string stats = string.Empty;
            for (int i = 0; i < 20; i++)
            {
                stats +=
                    new Random(DateTime.Now.Millisecond).NextDouble() + ",";
            }

            return stats.Substring(0, stats.Length - 1);
        }
开发者ID:divyanshmalik,项目名称:sa2014,代码行数:14,代码来源:Program.cs

示例2: CreateBackup

        /// <summary>
        /// Creates a copy of the given file, inserting a number between the
        /// filename and extension
        /// </summary>
        /// <param name="file">The file to create a copy of</param>
        /// <returns>The full name of the copy</returns>
        private static string CreateBackup(FileInfo file)
        {
            string theDirName = file.DirectoryName;
            string theFileNameNoExt = System.IO.Path.GetFileNameWithoutExtension(file.Name);
            string theExt = file.Extension;
            string theRandom = new Random().Next().ToString();
            theRandom = theRandom.PadLeft(5, '0');
            theRandom = theRandom.Substring(theRandom.Length - 5);

            string theBackupName = theDirName + System.IO.Path.DirectorySeparatorChar
                + theFileNameNoExt + "." + theRandom + theExt;

            File.Copy(file.FullName, theBackupName, true);

            return theBackupName;
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:22,代码来源:ProjectTransactionCmd.cs

示例3: buildSeeds

        private static void buildSeeds(object _params)
        {
            string sVendorSerial = null;
            long _ntotalCreated = 0;
            int seed = RandomGen.Next();
            InMemoryLogging loggerMatrixFile = null;
            long _nRequest = (long)((object[])_params)[1];
            string _nSerie = (string)((object[])_params)[2];
            string _outInf = "/Process:" + Thread.CurrentThread.GetHashCode().ToString() + " /thread:" + ((string)((object[])_params)[3]).Trim() + " /processing:" + _nRequest.ToString().Trim() + "/{0} ";
            ArrayList _vSm = (ArrayList)((object[])_params)[4];
            string _masterKey = SAFConfiguration.readMasterKey();

            TokenCryptoData _TokenCryptoData;
            TokenTypeBaseParams _tkParams = (TokenTypeBaseParams)((object[])_params)[0];
            InMemoryLogging logger = InMemoryLogging.GetLogString(cBASE_FILE_NAME + "." + ((string)((object[])_params)[3]).PadLeft(3, '0'), false);
            logger.MaxChars = -1;


            if (_tkParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
            {
                loggerMatrixFile = InMemoryLogging.GetLogString(cBASE_FILE_NAME_MATRIX + "." + ((string)((object[])_params)[3]).PadLeft(3, '0'), false);
                loggerMatrixFile.MaxChars = -1;
            }

            for (int i = 0; i < _nRequest; i++)
            {
                while (true)
                {
                    sVendorSerial = new Random(seed++).NextDouble().ToString();
                    sVendorSerial = sVendorSerial.Substring(sVendorSerial.Length - 12);

                    lock (_vSm)
                    {
                        if (!_vSm.Contains((object)sVendorSerial))
                        {
                            _vSm.Add((object)sVendorSerial);
                            break;
                        }
                    }
                }

                if (OperationResult.Success == TokensBaseFunctions.TokensCreateNew(_tkParams, _masterKey, sVendorSerial, "", out _TokenCryptoData))
                {
                    logger.Add(BaseImportExportTokens.Export(_TokenCryptoData, _nSerie));
                    if (_tkParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
                    {
                        loggerMatrixFile.Add(sVendorSerial + ";" + string.Join(";", TokensBaseFunctions.tokenTANMatrixArrayFetch(_TokenCryptoData, _masterKey, "")));
                    }
                    _ntotalCreated += 1;
                }
            }
            logger.Persist();
            if (loggerMatrixFile!=null) loggerMatrixFile.Persist();
        }
开发者ID:apedro-silva,项目名称:SF.Expand.SAF,代码行数:54,代码来源:GenerateSeeds.cs

示例4: buildSeeds

		private static void buildSeeds(object _params)
		{
			string text = null;
			long num = 0L;
			int num2 = RandomGen.Next();
			InMemoryLogging inMemoryLogging = null;
			long num3 = (long)((object[])_params)[1];
			string loteID = (string)((object[])_params)[2];
			string.Concat(new string[]
			{
				"/Process:",
				Thread.CurrentThread.GetHashCode().ToString(),
				" /thread:",
				((string)((object[])_params)[3]).Trim(),
				" /processing:",
				num3.ToString().Trim(),
				"/{0} "
			});
			ArrayList arrayList = (ArrayList)((object[])_params)[4];
			string masterKey = SAFConfiguration.readMasterKey();
			TokenTypeBaseParams tkTypeBaseParams = (TokenTypeBaseParams)((object[])_params)[0];
			InMemoryLogging logString = InMemoryLogging.GetLogString("seedsThread." + ((string)((object[])_params)[3]).PadLeft(3, '0'), false);
			logString.MaxChars = -1;
			if (tkTypeBaseParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
			{
				inMemoryLogging = InMemoryLogging.GetLogString("seedsThreadMatrix." + ((string)((object[])_params)[3]).PadLeft(3, '0'), false);
				inMemoryLogging.MaxChars = -1;
			}
			int num4 = 0;
			while ((long)num4 < num3)
			{
				while (true)
				{
					text = new Random(num2++).NextDouble().ToString();
					text = text.Substring(text.Length - 12);
					ArrayList obj;
					Monitor.Enter(obj = arrayList);
					try
					{
						if (arrayList.Contains(text))
						{
							continue;
						}
						arrayList.Add(text);
					}
					finally
					{
						Monitor.Exit(obj);
					}
					break;
				}
				TokenCryptoData tokenCryptoData;
				if (TokensBaseFunctions.TokensCreateNew(tkTypeBaseParams, masterKey, text, "", out tokenCryptoData) == OperationResult.Success)
				{
					logString.Add(BaseImportExportTokens.Export(tokenCryptoData, loteID));
					if (tkTypeBaseParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
					{
						inMemoryLogging.Add(text + ";" + string.Join(";", TokensBaseFunctions.tokenTANMatrixArrayFetch(tokenCryptoData, masterKey, "")));
					}
					num += 1L;
				}
				num4++;
			}
			logString.Persist();
			if (inMemoryLogging != null)
			{
				inMemoryLogging.Persist();
			}
		}
开发者ID:apedro-silva,项目名称:SF.Expand.SAF,代码行数:69,代码来源:GenerateSeeds.cs


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