AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Stringlist in zufällige Reihenfolge bringen
Thema durchsuchen
Ansicht
Themen-Optionen

Stringlist in zufällige Reihenfolge bringen

Ein Thema von Maekkelrajter · begonnen am 7. Sep 2023 · letzter Beitrag vom 9. Sep 2023
Antwort Antwort
Kas Ob.

Registriert seit: 3. Sep 2023
435 Beiträge
 
#1

AW: Stringlist in zufällige Reihenfolge bringen

  Alt 7. Sep 2023, 16:40
No sure if I understand the question 100%, but I would solve this by not using for-statement, it will just complicate the restrain the algorithm.
I think "While-do" or "Repeat-until" loop is better approach, something like:
Code:
  while Count < Required do
  begin
    SelectAtRandom; // from the pot
    if SelectedIsOK then
      begin
        StoreInList;
        Inc(Count);
        // Here we could adjust the selection condition like remove elements from the pot
      end; // else we pick again and ignore the selected
  end;
SelectedIsOK can be be multiple conditions, like simple check if the current pick artist is not the last (or 2nd,3th) artist in the selected list.
Kas
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:52 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz