News for hackers. Stuff that matters.
Re: by EarthLaunch on Monday May 22, 2023 @11:21PM (#36039410)
A while back there was a post about a randomness bug in Asheron's Call, the "Wi flag" [0]. I posted a comment there and was offered helpful answers about doing weighted randomness [1].

This library seems to solve that problem and half a dozen others! Like: Reading code with functions named for their purpose is better than a string of arithmetic operations in most cases. Thank you for sharing this! Will use in my game! [2]

    const weightedDiceRoll =
    weighted(
        [1,2,3,4,5,6],
        [1,1,1,1,1,10]
    )
    // will return 6 much more often than the other options
0: https://news.ycombinator.com/item?id=34742505

1: https://news.ycombinator.com/item?id=34742985

2: https://github.com/Suncapped/babs

Re: by chriscavs on Tuesday May 23, 2023 @11:13AM (#36045465)
thanks for the comment, i'm happy you like it!