Alright, first of all you would have to setup a list of items.
Have you looked into arrays in game maker? If you haven't I highly suggest you do! Without knowledge of arrays you won't be able to follow my explanation.
So setup a array as a list of objects:
Code:
items[0]=obj_sword
items[1]=obj_sword
items[2]=obj_my_sanity
Now you want to use the irandom(); function to get a random number between 0 and the highest entry in the array.
This happens to be 2 in my example, but if you want to get this programatically you can use array_length_1d() which will count the amount of items in an array, including 0, thus returning 3 for the examplearray. You will have to substract one of it giving you this code:
Code:
randomobject=items[irandom(array_length_1d(items)-1)]
Now you can use instance_create() for this.
From here, you have a few options on how to exactly implement it, but I'd suggest you use invisible spawning objects.
These objects would be invisible in your game, easy to put inside levels in the room editor and could contain the timers itself.
Practially put the code shown above in that spawner object.
To make it run at random times, you can again use the irandom() function together with some knowledge about the room_speed (look into this topic if you haven't already) and about alarms (look into what these do too).
Then in create you could say something like:
Code:
alarm[0]=irandom(room_speed*10)//room_speeds gives the amount of ticks in a single second. The ticks are practically how many times per second the step and draw events execute. Multiplying it by 10 will give you the amount of ticks in 10 seconds.
Then you'd spawn a randomly selected object using code shown above and instance_create()
Hope this puts you in the right direction.