API:Random/Sample code 1