HELP PLZ~ How to produce 4 random numbers together at one time? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

HELP PLZ~ How to produce 4 random numbers together at one time?

hz0522hz0522 Posts: 4Member
Can anyone tell me how to generate four random numbers at one time, but can not repeat the digits. For example 1234 is allowed, but 1223 is not allowed.
Thank You

Comments

  • norman_norman_ Posts: 20Member
    I think that I can help. First place 4 labels next to eachother, and with no borders so it will look like they are one label. The goto your number generating code and use the following code

    (procedure that does the generating)

    label1.caption = int (rnd * 10)
    label2.caption = int (rnd * 10)
    label3.caption = int (rnd * 10)
    label4.caption = int (rnd * 10)

    if label1.caption = label2.caption or label1.caption =label3.caption_ or label1.caption = label4.caption then label1.caption = int (rnd * 10)

    'Do the same if statement for each label (but remember to change the label numbers accordingly!)

Sign In or Register to comment.