[Solved] Generate words with odds(chance) without repeating

Discuss the spreadsheet application
Post Reply
Tugasmo
Posts: 2
Joined: Tue May 07, 2019 12:15 pm

[Solved] Generate words with odds(chance) without repeating

Post by Tugasmo »

Hello.

I am making a game and I am doing some base calculations/simulations with OOCalc to help me have a better idea of how I want things to work.
Right now, I am trying to simulate a "re-roll" of an item attribute where different attributes have different odds (chance of getting) than others.

Here's an example;

Spirit ----- 5% chance
Vigor ----- 5% chance
Agility ---- 15% chance
Vitality ----15% chance
Endurance-20% chance
Luck-------1% chance
Mana------20% chance
Power-----5% chance
Health----5% chance
Stamina--10% chance

This also can't repeat. The item has 5 attribute slots where each is different from the other.
Last edited by Tugasmo on Fri May 10, 2019 2:26 pm, edited 3 times in total.
OpenOffice 3.1 on Windows 10
User avatar
keme
Volunteer
Posts: 3704
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: Generating words with odds (chance) without repeating

Post by keme »

See whether the attached file does what you need. Quick and dirty: the list is "degenerated" by setting odds for used entries to 0.

Caveat: If the random number hits exactly "on the mark", a used entry may be reused, but that is not likely to ever happen.

Your odds in the list given add up to 101%, but that is handled gracefully by the formulas. The only requirement is that the odds be numerical.
Attachments
weighted random.ods
(14.59 KiB) Downloaded 83 times
Tugasmo
Posts: 2
Joined: Tue May 07, 2019 12:15 pm

Re: [Solved]Generating words with odds(chance) without repea

Post by Tugasmo »

keme wrote:.
Thanks for the trouble, buddy! That works!

EDIT:

I just noticed, when I try to line up the index from 6 different results, I get all but one like this:

=ÍNDICE($I$3:$I$15;J19;1)

Instead of the result (word).

https://i.imgur.com/RthuvQE.png

Edit2: I fixed it. Everything is working now. Thank you.

[SOLVED]
OpenOffice 3.1 on Windows 10
Post Reply