View Issue Details

IDProjectCategoryLast Update
0019353AI War 2Bug - OtherFeb 8, 2018 6:56 am
ReporterChris_McElligottPark Assigned Tokeith.lamothe  
Severityminor 
Status resolvedResolutionfixed 
Product Version0.702 Activating Mk1 Grinding Machine 
Fixed in Version0.706 
Summary0019353: NextWithInclusiveUpperBound in ArcenRandomDrawBag?
DescriptionRelated to 0019350, where it was legitimately a crash because I used it wrong. However, that led me to do a search for usage of this in the projects other than that, and I found three cases of this: two in ArcenRandomDrawBag (your code), and one in SFXClipRandomDrawBag (which I adapted from that because I needed slightly more specific functionality).

The actual error was not in either of those files, but I'd appreciate it if you could review ArcenRandomDrawBag and let me know if that usage of NextWithInclusiveUpperBound seems correct. If so, then probably it should be used again in SFXClipRandomDrawBag as well.

My thought is that with one of these approaches -- either the exclusive or the inclusive rand -- we're going to be excluding the last item in the weighted lists. My brain is sluggish and I can't think which one is going to be the case, though. Right now SFXClipRandomDrawBag has been shifted to just use Next(), but I'm not sure that's ideal after all.
TagsNo tags attached.

Relationships

related to 0019350 resolvedChris_McElligottPark crash in voice code 

Activities

keith.lamothe

Feb 8, 2018 6:56 am

administrator   ~0046925

The upper bound was fine, a unit test of a d6 (with 1 item each of 1,2,3,4,5, and 6 added in that order) showed that it returned 6 just as often as 2,3,4,5.

But I'm very glad you asked, because it turns out that the first item (1 in this case) was being returned twice as often as the others, because the roll was from 0 to count instead of 1 to count, and either a 0 or 1 equated to picking the first item.

Now it rolls from 1 to count and it's testing even. I applied that to both the normal random draw bag and your specialized sfx one.

Issue History

Date Modified Username Field Change
Jan 26, 2018 10:24 am Chris_McElligottPark New Issue
Jan 26, 2018 10:24 am Chris_McElligottPark Status new => assigned
Jan 26, 2018 10:24 am Chris_McElligottPark Assigned To => keith.lamothe
Jan 26, 2018 10:24 am Chris_McElligottPark Relationship added related to 0019350
Feb 8, 2018 6:56 am keith.lamothe Status assigned => resolved
Feb 8, 2018 6:56 am keith.lamothe Resolution open => fixed
Feb 8, 2018 6:56 am keith.lamothe Fixed in Version => 0.706
Feb 8, 2018 6:56 am keith.lamothe Note Added: 0046925