Everything is good but i would like an option over the script that will change the random generated number each x seconds, a value where i can choose on how many seconds another random number will be generated and shown
When you're wanting to start putting a timer on a script this generally indicates that your going to need a cron job to police it - unless you can get a nifty piece of ajax to do that for you (but that's outside the scope of my knowledge)
WRT the code you supplied - it looks to me like the top line is doing nothing, because your only using the bottom two lines of code.
I think (bearing in mind that its before coffee at the moment :)) that this would still function like this:-
<?php echo rand(1000,5000); ?>
Of course that's stripped down to bare bones, and there is not much memory usage there as it's a direct echo, and not assigned to memory.
There are bound to be a few suggestions, but as far as setting up a timer, you could have a page refresh or header() call with the delay parameter set, which you could have set in a db field somewhere which *could* achieve what your after. Of course this assumes that the page isn't top heavy with content.