Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Best way to generate a random permutation

A topic by toutankh created Feb 17, 2021 Views: 314 Replies: 2
Viewing posts 1 to 2

I am playing a game where four players take turns playing a certain role, and I want to randomise the sequence in which this happens. So what I want is a random permutation of four values (four player names). I am just discovering the program and am taking suggestion on how to best do that :) Two "solutions" I have thought about so far: use a D4 and re-roll if the outcome has already happened; throw a bunch of D4s and take values in the order of their frequency.

Developer

using the “unique” roll condition (‘U’), you can roll a pool of dice that will reroll repeat values. (Details in the documentation here). If you have a die with the names of your players, you can roll an expression which will output their names in a random order like this:



if you don’t want to make a die or are in a rush, number your players and then the expression “4d4TiU” can decide what order they go in.  This rolls 4d4, converts the dice values to individual text values (so they don’t get summed) and then applies the ‘unique’ condition so that duplicates get rerolled.


When you have an expression you’re happy to use, you can save it to your dice bag and roll it with a single hotbar click/tap whenever you need it.


Hope that helps! :)

(1 edit)

Thanks, that does help! The game I'm doing that for is Phasmophobia so your choice of names is remarkably fitting :)