How to stop repeating random number

  • How i can stop repeating random number

    I want random number but i don't want to repeat until all number covers

  • Hello,

    https://www.scirra.com/tutorials/315/ge ... duplicates

    This was write the 1, June 2012.

    Have a good day.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • is their any other way without using arrays?

  • If not to many numbers.....

    Give an object an instance variable 'RndNr'.

    Create instances during runtime (startup) and store values in 'RndNr' ...

    Or ... create them in the layout editor and assign the values there to 'RndNr' ...

    ..... As you wish.

    Mark them as picked with a boolean or destroy them. Say the boolean is named 'Used'.

    Then.

    Or :

    System > Pick random instance (Object)

    _____________action ... then number is in Object.RndNr

    _____________destroy object

    Or:

    Is boolean (Object) instance variable set ('Used')

    System > Pick random instance (Object)

    _____________action ... then number is in Object.RndNr

    _____________Set boolean 'Used' to true

    Or: If you want to reset the cycle, using that boolean

    Is boolean (Object) instance variable set ('Used')

    _______Sub System > Pick random instance (Object)

    _____________action ... then number is in Object.RndNr

    _____________Set boolean 'Used' to true

    Else

    ______Sub Pick all (Object)

    ____________action Set boolean 'Used' to FALSE

    _________Sub System > Pick random instance (Object) <---- sub under the 'pick all' to start from that picklist

    _______________action ... then number is in Object.RndNr

    _______________Set boolean 'Used' to true

    But, personal, i use and love the array way of doing this.

    Or the perfect blackhornet plugin

  • Hello,

    https://www.scirra.com/tutorials/315/ge ... duplicates

    This was write the 1, June 2012.

    Have a good day.

    in your tutorial both links are dead

  • luckyrawatlucky You have everything in the tutorial i dont understand why you complain.

    Programming and having a problem is the most fun thing.

    Now the most of time if you search a little bit you can easely find informations.

    -Tutorial

    -Plugin

    The plugin link that "99Instances2Go" post work pretty well.

    Before posting here please try to make more search.

    Have a really good day ! And have fun

  • No i am not complaining

    i am already following 99instance2go method

    but i just want to see your capx for review

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)