you can make a pool of objects you want inside chests and put them inside an array
var chestitems_array = [item1,item2,etc]
than you randomize the array and pick the 1st item on it, as an example
you can call that function with another var
var the_item = _random_item()
now for the chest to be usable just add an area to it and detect player entering and give him the item, or some key input or click.
If you want multiple slots on the chest you can just run this function for each slot or have another array with the slots and iterate thru the items array