Would anyone happen to know how to make a series of random values that are different?
Example:
An objects behaviors are to generate a series of numbers that are not the same.
The numbers range from 1-20, but the object will only choose 6 of those numbers and none of them will repeat.
JR01
March 10, 2023, 4:05pm
2
You can use a list and a random block to either:
Add a random value to a list, if it’s already in the list then roll again.
Have a list and randomly remove a value at a time, updating the list on each roll.
Umm, I already tried using the 2nd method and the value was not removing from the list, I don’t know what I was doing wrong when I followed the example.
Also, how would I do the first method? like I said I don’t really understand how lists work.
@CodeAlpaca should be able to explain them to you.
1 Like
JR01
March 10, 2023, 4:28pm
6
So there are 2 ways you can remove a value from a list here but first, remember that the pop input only removes the last value in the list.
Have a list 1-20 and use List Order behavior to shuffle the list and use the pop input to remove values from the list.
Or you can use remove on list modify after getting the radnom value you want. This would have more steps.
1 Like
So for the first step, it would list the outputted numbers in one go? or would I have to keep activating it until I get 6 values that are not the same?
JR01
March 10, 2023, 4:33pm
8
Pop only outputs the last value in the list and removes it.
You need to input pop for each time you want a value
1 Like
Oh wait, the trigger mailbox will activate it right?
JR01
March 10, 2023, 4:34pm
10
Yeah, the mailbox was just to show how to activate the system.
2 Likes
Awesome, it worked. Thank you so much.
3 Likes