I have a nice function that sums a group of random numbers generated with this function.
sum(round(Int8, floor(
rand(TruncatedNormal(var1, var2, var3, var4))))
for _ in 1:var5)
Most of the time it works fine, var5, the iterator for the for loop is calculated earlier in a function, and can legitimately be a zero. Therefore iterating by increasing from 1 to 0 doesn't work and throws an error. Is there a clean "check" in Julia that will simply produce a result of 0 for the whole function, or do I need to go back and enclose this function in an if statement to check the value of var5 prior to running it, and if var5<=0, produce an alternate result (0)? Thx. J