From bb5d60f6071625bdbedc10fc13cd830fc798d9c0 Mon Sep 17 00:00:00 2001 From: Sergey Khruschak Date: Sat, 19 Jul 2025 00:01:21 +0300 Subject: [PATCH] Random generation fixed --- Sources/table/Format.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/table/Format.swift b/Sources/table/Format.swift index 5c68917..32df12a 100644 --- a/Sources/table/Format.swift +++ b/Sources/table/Format.swift @@ -77,8 +77,8 @@ struct FunctionPart: FormatExpr { } if name == "random" { - let from = arguments.count == 1 ? try Int(arguments[0].fill(row: row))! : 0 - let to = arguments.count == 2 ? try Int(arguments[1].fill(row: row))! : try Int(arguments[0].fill(row: row))! + let from = arguments.count > 0 ? try Int(arguments[0].fill(row: row))! : 0 + let to = arguments.count == 2 ? try Int(arguments[1].fill(row: row))! : try Int(arguments[0].fill(row: row))! return String(Int.random(in: from...to)) }