I just exported after importing your project, I turned on:
Extensions Support
Thread Support
Progressive Web App Enabled
And it runs fine in my browsers (Brave, Chrome Canary, Firefox Nightly) on Windows 10, where in your project can I test the rand_weighted()?
Edit 1
When booting up the game I click a random lesson then click Start Lesson and get this in my F12 console:
index.js:462 3
index.js:462 3
index.js:462 [1, 1, 1, 1, 1, 1, 1]
index.js:462 string two
index.js:462 e
index.js:462 (before the direct object)
index.js:462 [1, 1, 1, 1, 1, 1, 1.5]
index.js:462 string one
index.js:462 pali
index.js:462 do, take action on, work on; build, make, prepare
Checking your code now, but does this look familiar? Is this the right repro steps? If so, it looks like rand_weighted() is working on HTML5 export and it’s likely something else on your end.
I believe these Debug statements align with this part of your flashcards.gd script but want to make sure:
func next():
# there is a rand_weighted() function
#var new_word = words[rng.rand_weighted(weights)]
var result = ["string one", "string two", "whatever"][rng.rand_weighted([0.5, 1, 1])]
print(result)
var new_word = words.pick_random()
print(new_word)
var type = [FlashcardType.LATIN, FlashcardType.SITELEN, FlashcardType.BOTH].pick_random()
card.set_flashcard_type(type)
card.set_word(new_word)
card.refresh_display()
Edit 2
Yea it looks like this is the right code, more F12 Debug output:
index.js:462 ear; to hear, listen; pay attention to, obey
index.js:462 [1, 1.39999997615814, 1, 1.5, 1, 1, 1]
index.js:462 whatever
index.js:462 e
index.js:462 (before the direct object)
index.js:462 [1, 1.39999997615814, 1, 1.5, 1, 1, 1]
index.js:462 string two
index.js:462 pali
index.js:462 do, take action on, work on; build, make, prepare
index.js:462 [1, 1.39999997615814, 1, 2, 1, 1, 1]
index.js:462 string two
This also appears to be right in terms of order/count of print() statements. Is there perhaps another thing you were testing which made it seem like rand_weighted() wasn’t working? I recommend hosting a Debug version of the export and stepping through your browser’s F12 console because this isn’t something reproducible with the same project files. I’d also try with different browsers on your end to see if there’s any differences in behavior on that front.