I get an error saying that my bound must be positive. Here is the line I get it on:
inv.setItem(i, items.get(r.nextInt(items.size())));
As
The issue is that you are calling Random.nextInt() with a zero and it doesn't like that. That is happening because the List from getAllItems() is empty. I would prevent this situation by checking that the list has items before performing your logic:
List items = getAllItems(level);
if(!items.isEmpty()) {
inv.setItem(i, items.get(r.nextInt(items.size())));
}