Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
White Dwarf Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Nest
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
EN Publishing
Twitter
BlueSky
Facebook
Instagram
EN World
BlueSky
YouTube
Facebook
Twitter
Twitch
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Community
General Tabletop Discussion
*Pathfinder & Starfinder
Probability in Char. Gen.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Asmor" data-source="post: 2180085" data-attributes="member: 1154"><p>Well, doing the "monte carlo" approach of just rolling up a huge number of characters (in my case 1,000,000), here's what I got:</p><p></p><p>30.446762</p><p>Total iterations: 1145248</p><p>Characters tossed: 145248</p><p>Characters kept: 1000000</p><p></p><p>Here's the code in case anyone's curious, behind a spoiler because there's really nothing new or interesting. If you want to use it to run more tests, just change the variable iterations.</p><p></p><p>[code]</p><p>package com.asmor.dnd;</p><p></p><p>public class montecarlo {</p><p></p><p>private static int d6() {</p><p> return (int) Math.floor(Math.random()*6)+1;</p><p>}</p><p></p><p>private static int stat(int r1, int r2, int r3, int r4) {</p><p> int dice[]=new int[4], smallest=0, i, toReturn=0;</p><p> dice[0]=r1;</p><p> dice[1]=r2;</p><p> dice[2]=r3;</p><p> dice[3]=r4;</p><p></p><p> for (i=1; i<4; i++) {</p><p> if (dice[i]<dice[smallest]) {</p><p> smallest=i;</p><p> }</p><p> }</p><p> for (i=0; i<4; i++) {</p><p> if (i!=smallest) {</p><p> toReturn+=dice[i];</p><p> }</p><p> }</p><p> return toReturn;</p><p>}</p><p> </p><p>public static void main(String[] args) {</p><p></p><p>int totalValue=0, iterations, iterate=0, tossed=0, kept=0, stats[]=new int[7], mods[]={-5, -5, -4, -4, -3, -3, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 3, 3, 4}, i, toss, totalMod, pbv, cameUp[]=new int[19];</p><p>int PBValues[]={0, 0, 0, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16};</p><p></p><p>//Number of good character to generate:</p><p>iterations=1000000;</p><p></p><p>while (kept<iterations) {</p><p></p><p> iterate++;</p><p></p><p> for (i=0; i<6; i++) {</p><p> stats[i]=stat(d6(), d6(), d6(), d6());</p><p> }</p><p></p><p> toss=1;</p><p> totalMod=0;</p><p> for (i=0; i<6; i++) {</p><p> if (stats[i]>13) {</p><p> toss=0;</p><p> }</p><p> totalMod+=mods[stats[i]];</p><p> }</p><p> </p><p> if (totalMod<=0) {</p><p> toss=1;</p><p> }</p><p> </p><p> if (toss==0) {</p><p> kept++;</p><p> pbv=0;</p><p> for (i=0; i<6; i++) {</p><p> pbv+=PBValues[stats[i]];</p><p> }</p><p> totalValue+=pbv;</p><p> } else if (toss==1) {</p><p> tossed++;</p><p> }</p><p></p><p>}</p><p></p><p>System.out.print((double)totalValue/(double)iterations+"\n");</p><p>System.out.print("Total iterations: "+iterate+"\nCharacters tossed: "+tossed+"\nCharacters kept: "+kept+"\n");</p><p></p><p>}</p><p>}</p><p>[/code]</p><p></p><p>Edit: Err... I tried to make that cool spoiler box thingie that hides everything, but instead it made all the text black. Is (spoiler) not the right tag?</p></blockquote><p></p>
[QUOTE="Asmor, post: 2180085, member: 1154"] Well, doing the "monte carlo" approach of just rolling up a huge number of characters (in my case 1,000,000), here's what I got: 30.446762 Total iterations: 1145248 Characters tossed: 145248 Characters kept: 1000000 Here's the code in case anyone's curious, behind a spoiler because there's really nothing new or interesting. If you want to use it to run more tests, just change the variable iterations. [code] package com.asmor.dnd; public class montecarlo { private static int d6() { return (int) Math.floor(Math.random()*6)+1; } private static int stat(int r1, int r2, int r3, int r4) { int dice[]=new int[4], smallest=0, i, toReturn=0; dice[0]=r1; dice[1]=r2; dice[2]=r3; dice[3]=r4; for (i=1; i<4; i++) { if (dice[i]<dice[smallest]) { smallest=i; } } for (i=0; i<4; i++) { if (i!=smallest) { toReturn+=dice[i]; } } return toReturn; } public static void main(String[] args) { int totalValue=0, iterations, iterate=0, tossed=0, kept=0, stats[]=new int[7], mods[]={-5, -5, -4, -4, -3, -3, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 3, 3, 4}, i, toss, totalMod, pbv, cameUp[]=new int[19]; int PBValues[]={0, 0, 0, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16}; //Number of good character to generate: iterations=1000000; while (kept<iterations) { iterate++; for (i=0; i<6; i++) { stats[i]=stat(d6(), d6(), d6(), d6()); } toss=1; totalMod=0; for (i=0; i<6; i++) { if (stats[i]>13) { toss=0; } totalMod+=mods[stats[i]]; } if (totalMod<=0) { toss=1; } if (toss==0) { kept++; pbv=0; for (i=0; i<6; i++) { pbv+=PBValues[stats[i]]; } totalValue+=pbv; } else if (toss==1) { tossed++; } } System.out.print((double)totalValue/(double)iterations+"\n"); System.out.print("Total iterations: "+iterate+"\nCharacters tossed: "+tossed+"\nCharacters kept: "+kept+"\n"); } } [/code] Edit: Err... I tried to make that cool spoiler box thingie that hides everything, but instead it made all the text black. Is (spoiler) not the right tag? [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*Pathfinder & Starfinder
Probability in Char. Gen.
Top