saya gunakan source ini utk mengacak bilangan integer dari -n ... n
mudah-mudahan membantu ;
mudah-mudahan membantu ;
procedure Shuffle(var baris; hitung_item: Integer; ukuran_item: Integer); var I: Integer; Randi: Integer; item_swap: PByteArray; A: TByteArray absolute baris; begin if (hitung_item > 1) then begin GetMem(item_swap, ukuran_item); try for I := 0 to (hitung_item - 2) do begin Randi := Random(hitung_item - I); Move(A[I ukuran_item], item_swap^, ukuran_item); Move(A[Randi ukuran_item], A[I ukuran_item], ukuran_item); Move(item_swap^, A[Randi ukuran_item], ukuran_item); end; finally FreeMem(item_swap, ukuran_item); end; end; end; |
saya gunakan komponen listbox utk menampilkan bilangan integer yang random serta menggunakan komponen button utk merandom
procedure TForm1.tbl_BuatBilanganRandomClick(Sender: TObject); var a: array[-9..40] of Integer; // disini anda dapat mengganti misalnya [0..40] ato [-60..900] i: Shortint; begin listbox1.Items.Clear; Randomize; for i := Low(a) to High(a) do a[i] := i; Shuffle(a, High(a), SizeOf(Integer)); for i := 1 to High(a) - 1 do ListBox1.Items.Add(IntToStr(a[i])); end; |
Silahkan dicoba.
Random Articles
- Tip compile di Lazarus ke target CPU 64 Bit (Mac Only)
- Comport
- List SQL Server in network
- Mendeteksi drive baru /removable drive
- Tiga solusihutdown Untuk Keluarga Win NT
- Membuat sendiri UDF library bag.2
- Campur aduk beberapa file Executables menjadi satu...
- Lazarus 2.2.0 Release Candidate 1
- free barcode component for delphi 4,5,6,7
- POC: Smarter Lazarus/FreePascal with OpenAI and FastPlaz
AI Forward

๐ We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now:
https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD
Last Articles
Recent Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 4 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 5 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 12 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 12 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 12 years ago