Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 11th November 2011
Braincode's Avatar
Braincode Braincode is offline
Ceriwis Addicted
 
Join Date: Nov 2011
Posts: 4,638
Rep Power: 20
Braincode mempunyai hidup yang Normal
Default [ask] Algoritma Generate Random Number di Mysql

Agan-agan programmer handal... mohon bantuannya donk...

gue lagi bingung bikin procedure generate random number neh di mysql...

gue dah bikin step2 procedurenya seperti ini (sry dalam bhs inggris)..



1) Create a random number from 0 to 999

2) Check the database to see if the number exists

OR

2) Query the database for all numbers

3) See if the returned result matches whatever came from the db

4) If it matches, repeat step 1, if not, problem is solved.



Nah, yg jadi masalah adalah, jika angka-angka ini sudah digenerate dan di sortir akan urut dengan kelipatan +1.

masalahnya, gw bisa prediksi kalo next number dari 10 adalah 11, nah, gw pengennya next numbernya itu belum tentu 11, mungkin 13 ato yang lain.Kira-kira ada tambahan ga ya dari algoritma ini...



Output yg gw inginkan adalah random number (misal 3 digit) yang unpredictable next number nya...



kalo ada referensi, terima kasih sekali gan, gw searching2 ga nemu2 neh...



Thx atas bantuan nya...



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 04:06 PM.


no new posts