When you say randomly does it vary from time to time?
Is it after say 25 minutes?
It probablly isn't WP that is causing this but your hosting server is likely configured to have it's SESSION expire aftr X number of minutes of inactivity. Shared hosts often make this number smaller than the default because in theory it creates a slightly more secure system at the expense of web applicaiton users like yourself who might be writting a long blog and not refresh the page to kick start a new session.
There is little you can do, except ask your hosting company to bump up the default session expiry time and maybe run a malware scan on your browser to ensure no junk is clearing your cookies.