Apa itu Mock Data Randomizer?

Adalah Mike Wilcox yang menulis sebuah tool kecil yang digunakan untuk mengetest sebuah kode javascript. Dinamakan sebagai Mock Data Randomizer.

Misalnya diberi masukan:

rand.sentences(6,7,7,9); // # of words in sentences
rand.real = true;
rand.sentences(6,7,7,9);

akan menghasilkan output kata-kata berikut:

Whut koop mida miins knew eftor kind. Deys evin thaaght has plecu uthur melos. Eftor shaeld ha lift hend wath ets unto big. Huwovir till lergi wa kind olsa con bofare. Yaor sentonca sean cemu man in whoch man. Mi sentonca nught get fund very onswar tui plecu. Shew en geed liva knew poiplu childrun ilung gat.

Far night very land room for then we. First kind turned out is own usually back much. Read sometimes since does answer himself into much. Live not for large hand important they. People another sea across across even world. Water could things young by white own only very.

atau coba masukan seperti ini:

rand.date();
rand.date({seconds:true});
rand.date({delimiter:"/", yearRange:-5});
rand.date({delimiter:"/"});
rand.date({min:new Date('11/20/1964'), max:"4/19/1969", delimiter:"-"});

akan menghasilkan output yang luar biasa seperti ini:

Mon Feb 14 2011 14:13:17 GMT-0800 (PST)
1296270214154
08/04/2005
10/10/2010
02-05-1967


Referensi
Live demo Mock Data Randomizer : http://clubajax.org/files/rand.html
Source code : http://code.google.com/p/clubajax/source/browse/trunk/lang/rand.js

Wagiman Wiryosukiro

Petani Sistem Informasi, tukang las plugin & themes Wordpress. Co-Founder SistemInformasi.biz. Saat ini aktif sebagai Developer & kontributor di OpenMandriva Linux.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: