There is no function atm, but I could make you one (haven't tested this one).
That should work.
While making this I found another bug in the smuggling findfirstcontrabandgood again
Code:
int getRandomContrabandGood(ref CurIsland)
{
aref islRef; makearef(islRef,CurIsland.Trade.Contraband);
int n = GetAttributesNum(islRef)
if(n < 1) return -1;
int goodidx = rand(n);
return sti(GetAttributeValue(GetAttributeN(islRef,goodidx)));
}
That should work.
While making this I found another bug in the smuggling findfirstcontrabandgood again