Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo,

ich hätt da mal wieder ein Problem ...

... also mir war langweilig also fing ich ein kleines Mastermindprogramm in Access zu programmieren (Access weil ich derzeit nix anderes kann, wenn ichs hin hab kommts in VB aber bis dahin erstmal VBA außerdem hab ich auf Arbeit kein VB) ....

... na jedenfalls macht dieses Spiel nur Sinn wenn die zu eratende Farbkombination jedesmahl unterschiedlich ist ... also nehmen man Rnd() ... super dacht ich mir klappt ja prima ... aber es wäre zu schön gewesen ...

... denn es kommt immer die gleiche Zufallszahl bzw. sogar Farbkombination beim Starten der Datenbank.

Glaubt ihr nicht ... probierts aus ... schreibt in euer Startformular der Datenbank einfach : msgbox(rnd())

... also wer kann mir helfen und mir sagen wie ich es hinbekomme, dass bei jedem Start der DB ne andere Zahl bzw. Farbkombination kommt ...

Vielen Dank im Voraus.

hi,

vor dem ersten aufruf von rnd() einmal Randomize() aufrufen sollte das problem beheben. also:

call randomize()

call msgBox(rnd())

hilfreich hierzu auch die msdn

hth

Hallo,

das liegt daran, dass praktisch jede Programmiersprache Pseudozufallszahlen erzeugt, die von einem bestimmten "seed" abhängen. Diese seed lässt sich in C beispielsweise mit "srand" setzen. Access sollte eine entsprechende Funktion bieten, als seed-Wert kannst Du beispielsweise die aktuelle Zeit verwenden.

Nic

Am besten das Randomize an den Timer koppeln.

Der erzeugt mit hoher Sicherheit keine gleichen Zufallszahlen.

Private Sub Befehl0_Click()

Randomize (Timer)

MsgBox (Rnd())

End Sub

"Randomize Timer" ist identisch mit "Randomize"! (siehe MSDN)

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.