AdysTech.InfluxDB.Client.Net.Tests.DataGen.RandomDouble C# (CSharp) Method

RandomDouble() public static method

public static RandomDouble ( ) : double
return double
        public static double RandomDouble()
        {
            lock ( syncLock )
            { // synchronize
                return random.NextDouble ();
            }
        }

Usage Example

        public async Task TestPostPointsAsync_FromObject_AutogenRetention()
        {
            try
            {
                var client    = new InfluxDBClient(influxUrl, dbUName, dbpwd);
                var retention = new InfluxRetentionPolicy()
                {
                    Name = "autogen", DBName = dbName, Duration = TimeSpan.FromMinutes(0), IsDefault = true
                };
                var points = Enumerable.Range(0, 10).Select(i =>
                                                            new PointObjectWithObjectRetention
                {
                    Measurement = "RetentionTest",
                    Time        = DateTime.UtcNow.AddDays(-i),
                    Retention   = retention,
                    Precision   = TimePrecision.Milliseconds,
                    StringTag   = "FromObject",
                    IntTag      = DataGen.RandomInt(),
                    StringField = DataGen.RandomString(),
                    DoubleField = DataGen.RandomDouble(),
                    IntField    = DataGen.RandomInt(),
                    BoolField   = i % 2 == 0,
                });

                var r = await client.PostPointsAsync(dbName, points);

                Assert.IsTrue(r, "PostPointsAsync returned false");
            }
            catch (Exception e)
            {
                Assert.Fail($"Unexpected exception of type {e.GetType()} caught: {e.Message}");
                return;
            }
        }
All Usage Examples Of AdysTech.InfluxDB.Client.Net.Tests.DataGen::RandomDouble