add function data_generater to simplify examples