I was searching this and wanted to add my solution:
This is how you can create 2D array with (x,f(x)) values in sorted order.
#Create 30 random number between 0 and 1
k = np.random.random ((30,2))
k= np.sort(k,0) #sort x values
for i in range(len(k[:])):
k[i][1] = f(k[i][0])