public static Tuple <bool, float> GetStockChangePercent(VolatilityDetail detail) { bool isCrashing = UnityEngine.Random.Range(1f, 100f) < detail.chanceOfCrash; if (isCrashing) { return(Tuple.Create(true, -1 * UnityEngine.Random.Range(detail.minCrashPercent, detail.maxCrashPercent))); } float directionModifier = UnityEngine.Random.Range(1f, 100f) < detail.chanceOfIncrease ? 1 : -1; return(Tuple.Create(false, directionModifier * UnityEngine.Random.Range(detail.minIncrease, detail.maxIncrease))); }
public StockData(StockType stockType) { this.StockType = stockType; volatility = GameUtils.GetVolatility(stockType.Riskyness); sharePrice = Random.Range(stockType.MinStartingValue, stockType.MaxStartingValue); }