This is from my experience, I'm not an electrician or anything. :lol:
When you hear a rattling noise while moving, or shaking a bulb, it usually means the filament has loosened or broken. If it still works, it may not have completely detached and will work for awhile longer. This has happened to me a few times, especially when I'm cleaning tanks since I have a top-screen opening and not a front opening. Sometimes I drop them or set them down wrong and then I notice the rattling noise. When the light was still working for me, it didn't last too much longer.