Are you running computer experiments to verify conjectures? If so, the GAP SmallGroups library will give you exactly what you want up to $n = 1023$.
For example, the GAP commands
n:=16;; G:=SmallGroup(n, Random(1,NumberSmallGroups(n)));
will return you a group chosen uniformly at random from the groups of order $n=16$. Similar commands will work up to $n=1023$. Indeed, it will work for also for all orders up to 2000 except for 1024, and for a considerable number of other orders.
You might also find the SmallGroups library web page to be helpful.
It describes some of the methods involved. If you're willing to select a group uniformly at random from a subcollection of all the groups of order $2^k$, then there are several papers on groups of order $2^k$ (for varying values of $k$) cited there. Applying the methods therein might be enough for you, depending on what your specific needs are.