Chest loot spawn chance

Hello Unity users,

So I’m currently working on a multiplayer survival game in Unity 5.
And I thought it would be cool to have like small towns, where you could find chests with loot in them. I just don’t want to put loot in the chest but want it to choose what kind of loot to be in there itself. So take this for an example:

So let’s say I have these items, and the spawn percentage:
Bayonet knife = 10%
Wood = 50%
Stone = 50%
A pistol = 8%
A shotgun = 6%
A hatchet = 10%
A pickaxe = 10%

And let’s say I have 3 spaces in the chests, and when a player opens it, it chooses randomly what spawns in the chest.

How can I make a script so when I press “E” on a chest, a inventory box pops up with the randomly chosen items?

Thanks for reading, I really hope you can help me.
Sorry for bad English :confused:

its a good start from here: