random x windowing code