using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text; using TurfCS; namespace OnlineUserPool.Unility { public class CommonHelper { public static double GetDistances(double lon, double lat, double lon1, double lat1) { var pt1 = Turf.Point(new double[] { lon, lat }); var pt2 = Turf.Point(new double[] { lon1, lat1 }); var value = Turf.Distance(pt1, pt2, "kilometers") * 1000; return Math.Round(value, 2); } public static int GenerateRandomInteger(int min = 0, int max = int.MaxValue) { var randomNumberBuffer = new byte[10]; new RNGCryptoServiceProvider().GetBytes(randomNumberBuffer); return new Random(BitConverter.ToInt32(randomNumberBuffer, 0)).Next(min, max); } } }