static QueryResult() { expressionParser.AddFunc("rand", inputs => { if (inputs == null) { throw new ArgumentNullException(nameof(inputs)); } if (inputs.Length != 2) { throw new ArgumentException("Function random should have only two input parameter.", nameof(inputs)); } float min = (float)inputs[0]; float max = (float)inputs[1]; if (min > max) { throw new ArgumentException("The first parameter should be less then the second", nameof(inputs)); } return(random.NextDouble() * (max - min) + min); }); }