Ambien is IMO dangerous...it can cause anterograde amnesia.
I once took one to get to sleep and sometime during the night I raided the icebox and ate half a cherry pie! Had no memory of it in the morning.
It binds to GABA sites, that is the cause of the amnesia.
I take it and always make sure to turn off my computer beforehand. I have bought stuff on EBay and did not remember. I have eaten without remembering too but not that often.