new API for random pattern
new API for random pattern