yet another random question (question about random)

LightChaosma

New Member
Reaction score
60
is it possible to crate a line of numbers in random order, for instance i need 40 numbers in random order

5
17
32
18
2
10
28
.
.
.


without having any doubles?

i can think of 1 way... but, well it is a loop with legth 1000 checking if the number has already been used, and it wtill woulddt be perfect...
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
i think this trigger will work:
Code:
Untitled Trigger 001
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Integer2 Less than 40
            Then - Actions
                Set Integer1[Integer2] = (Random integer number between 1 and 100)
                For each (Integer A) from 1 to 100, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Integer1[Integer2] Equal to Integer1[(Integer A)]
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        Integer2 Not equal to (Integer A)
                                    Then - Actions
                                        Trigger - Run (This trigger) (ignoring conditions)
                                    Else - Actions
                            Else - Actions
                                Set Integer2 = (Integer2 + 1)
                                Trigger - Run (This trigger) (ignoring conditions)
            Else - Actions
you need integer1[] with array for your numbers and Integer2 as loop.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Map init:

For each Integer A from 1 to 40
- Set array[Integer A] = (Integer A)
Set Count = 40


When you need a number:

Set TempInteger = Random integer between 1 and Count
... do something with array[TempInteger]
Set array[TempInteger] = array[Count]
Set Count = Count - 1
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top