public static string generateClientContext() { return (((long)Math.Round(microtime(true) * 1000) << 22 | NextLong(long.MinValue, long.MaxValue) & 4194303) & long.MaxValue).ToString(); } public static long NextLong(long min, long max) { System.Random rd = new System.Random(); if (max <= min) throw new ArgumentOutOfRangeException("max", "max must be > min!"); ulong uRange = (ulong)(max - min); ulong ulongRand; do { byte[] buf = new byte[8]; rd.NextBytes(buf); ulongRand = (ulong)BitConverter.ToInt64(buf, 0); } while (ulongRand > ulong.MaxValue - ((ulong.MaxValue % uRange) + 1) % uRange); return (long)(ulongRand % uRange) + min; } internal static double microtime(bool need_double_with_dot) { string val = Settings.GetLongUnixtime(DateTime.Now); if (need_double_with_dot) val = val.Insert(val.Length - 3, ","); double res = 0; //format 1565115353.205 try { res = double.Parse(val); //format 1565115353.205 } catch { val = val.Replace(",", "."); res = double.Parse(val); //format 1565115353,205 } //time()//1602698651.770 return res; } string client_context = Settings.generateClientContext();