blob: 9beb7879a02f40f88a6b164dda0096d3fefd3194 [file] [log] [blame]
using System;
using System.Collections.Generic;
using OfficeOpenXml.FormulaParsing.ExpressionGraph;
namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
public class Rand : ExcelFunction {
private static int Seed { get; set; }
public override CompileResult Execute(
IEnumerable<FunctionArgument> arguments,
ParsingContext context) {
Seed = Seed > 50 ? 0 : Seed + 5;
var val = new Random(System.DateTime.Now.Millisecond + Seed).NextDouble();
return CreateResult(val, DataType.Decimal);
}
}