Double() public static method

Gets the next double
public static Double ( ) : double
return double
        /// <summary>
        /// Gets a random price
        /// </summary>
        /// <param name="min">Minimum amount</param>
        /// <param name="max">Maximum amount</param>
        /// <param name="decimals">Number of decimals</param>
        /// <param name="symbol">Symbol to append</param>
        /// <returns>A <see cref="string"/></returns>
        public static string Price(decimal min, decimal max, int decimals, string symbol = "")
        {
            var amount = max - min;
            var part   = (decimal)Number.Double() * amount;

            return(symbol + Math.Round(min + part, decimals));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Gets a random longitude between -180 to 180
 /// </summary>
 /// <returns>Double of longitude value between -180 to 180</returns>
 public static double Longitude()
 {
     // between -180 to 180
     return(Math.Round((Number.Double() * 360) - 180, 4));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Gets a random latitude between -90 to 90
 /// </summary>
 /// <returns>Double of latitude value between -90 to 90</returns>
 public static double Latitude()
 {
     // between -90 to 90
     return(Math.Round((Number.Double() * 180) - 90, 4));
 }