Wednesday, April 23, 2014

Fungsi VBA Untuk Random Number's Generator

www.AstroDigi.com AstroDigi.com | Senin, 21 Apr 2014 | Seorang siswa pelatihan software pernah bertanya kepada saya, bagaimana cara membuat random number (nomor acak) seperti yang tertera pada voucher pulsa HP.

Bila kita beli voucher pulsa HP (yang non elektrik tentunya), untuk mengisikan pulsa kita diminta untuk mengisikan 16 digit angka yang tertera pada voucher bukan. Angka acak tersebut adalah hasil dari aplikasi penghasil nomor acak atau disebut Random Number's Generator.

Mari kita buat sendiri aplikasi penghasil angka acak tersebut.
Script dari fungsi tersebut adalah sebagai berikut:

Public Function Acak(JumlahDigit As Integer)
Dim Acak2 As String
Do
JumlahDigit = JumlahDigit - 1
Randomize   'harus dideklarasikan sebelum menjalankan Rnd
Acak2 = Acak2 & Chr(Int((57 - 48 + 1) * Rnd + 48)) 'acak dari ASCII 48 s/d 57 (=0 s/d 9)
Loop Until JumlahDigit = 0
Acak = Acak2
End Function

'------------------------------------------

Untuk menjalankannya user cukup mengetikkan Acak(jumlah digit yang diinginkan).
contoh:

Dim nilaiku As String
nilaiku = Acak(10)

hasilnya > nilaiku akan berisi angka acak 10 digit
misalnya: 5169492041

Anda bisa memanfaatkan nomor acak ini sebagai password, yang tentu lebih sulit diterka dibandingkan password yang angkanya masih berkorelasi dengan anda (tanggal lahir, no phone, plat nomor, dll). Anda juga bisa memanfaatkan nomor acak sebagai nomor undian pada suatu acara, tentu akan lebih menarik dibandingkan menggunakan nomor urut. Dan masih banyak lagi kegunaan lainnya.

Anda bebas menentukan sendiri mau berapa digit angka acaknya.
Semoga tutorial ini bermanfaat bagi anda. Selamat mencoba . . . have a nice day :-)


 www.AstroDigi.com (Nino Guevara Ruwano)

Comments :

10 comments to “Fungsi VBA Untuk Random Number's Generator”

ninest123 07.31
true religion jeans, oakley sunglasses, louboutin, michael kors outlet, michael kors outlet, coach outlet, longchamp outlet, tiffany jewelry, christian louboutin outlet, michael kors, kate spade outlet, prada handbags, ray ban sunglasses, gucci outlet, tiffany and co, replica watches, michael kors outlet, coach outlet, nike air max, polo ralph lauren outlet, louboutin shoes, ray ban sunglasses, tory burch outlet, michael kors outlet, jordan shoes, nike air max, oakley sunglasses, chanel handbags, coach purses, kate spade handbags, nike free, coach factory outlet, burberry, longchamp outlet, burberry outlet online, nike outlet, prada outlet, oakley sunglasses, polo ralph lauren outlet, longchamp, michael kors outlet, louboutin outlet

ninest123 Ninest said...
on 

true religion outlet, mulberry, lacoste pas cher, true religion jeans, nike air max, new balance pas cher, abercrombie and fitch, lululemon, hermes, nike blazer, longchamp pas cher, air force, vans pas cher, michael kors, nike free run uk, north face, sac guess, nike air max, air jordan pas cher, burberry, converse pas cher, north face, louboutin pas cher, nike air max, nike free, vanessa bruno, ralph lauren pas cher, sac longchamp, michael kors, ralph lauren uk, ray ban uk, air max, hollister, oakley pas cher, michael kors, hogan, tn pas cher, hollister pas cher, ray ban pas cher, nike roshe run, true religion jeans, timberland

ninest123 Ninest said...
on 

wedding dresses, soccer jerseys, nike roshe, abercrombie and fitch, iphone 6 cases, ferragamo shoes, reebok shoes, soccer shoes, ghd, asics running shoes, nike huarache, lululemon, vans shoes, instyler, nike roshe, oakley, insanity workout, p90x workout, mcm handbags, north face outlet, beats by dre, celine handbags, bottega veneta, baseball bats, north face outlet, longchamp, giuseppe zanotti, hollister, valentino shoes, new balance, nfl jerseys, hollister, jimmy choo shoes, babyliss, herve leger, mac cosmetics, birkin bag, timberland boots, chi flat iron, nike trainers, mont blanc, nike air max

ninest123 Ninest said...
on 

swarovski, replica watches, toms shoes, ugg boots, supra shoes, marc jacobs, montre pas cher, links of london, thomas sabo, vans, hollister, ugg pas cher, ugg,ugg australia,ugg italia, nike air max, ray ban, ugg boots uk, ugg boots, ugg,uggs,uggs canada, karen millen, gucci, bottes ugg, lancel, uggs on sale, ralph lauren, hollister, converse, wedding dresses, pandora charms, louboutin, juicy couture outlet, converse outlet, juicy couture outlet, pandora charms, swarovski crystal, ugg boots, coach outlet, pandora jewelry, ugg boots
ninest123 07.31

ninest123 Ninest said...
on 

ugg outlet
yeezy boost
oakley sunglasses,oakley outlet sunglasses
http://www.chromehearts.in.net
tiffany and co jewellery
Cheap NFL Jerseys China
tiffany jewellery
cheap real jordans
jordan retro
cheap oakley sunglasses
cheap tiffanys
cheap oakley sunglasses
kobe basketball shoes
air jordan retro
kobe shoes
oakley sunglasses wholesale
michael kors handbags
http://www.oakleystoreonline.us.org
tiffany and co outlet
michael kors outlet online
michael kors outlet

Chen Jeje said...
on 

michael kors handbags outlet
ghd hair straighteners
supra shoes sale
michael kors handbags online
skechers outlet
nike free
nike roshe run
yeezy boost 350 black
supra shoes
versace

raybanoutlet001 said...
on 

christian louboutin
uggs
cheap nike shoes
pandora bracelet
hollister clothing store
michael kors outlet clearance
louis vuitton outlet store
michael kors handbags
fake rolex watches
cheap nike sneakers
20161114yuanyuan

John said...
on 

michael kors handbags
new balance shoes
los angeles clippers jerseys
salomon boots
michael kors handbags outlet
nike huarache
yeezy boost 350 white
boston celtics jersey
michael kors handbags
los angeles lakers

Unknown said...
on 

yeezy boost 350
adidas shoes
gucci outlet
nike outlet
michael kors outlet
ralph lauren uk
christian louboutin shoes
adidas outlet
pandora jewelry
swarovski jewellery
20170324huazhen

Meiqing Xu said...
on 

louis vuitton outlet online
pandora jewellery
cheap ray ban sunglasses
coach outlet online
gucci outlet online
adidas uk store
lebron shoes
michael kors outlet
michael kors canada
ralph lauren
20170524ck

Gege Dai said...
on 

Post a Comment

Related Posts Plugin for WordPress, Blogger...