This is a cool problem! Can I increase the chances to pick a certain (random) number in a given range? Let's say I have 10 numbers from 1 to 10 and I wish number "3" to have 1,6x the chances to be picked. Till now I did this by creating 10 instances of every number in the range. If I wanted number "3" to have 60% more "luck" I created 16 instances of it instead of 10. Then I put all the instances inside an array and random pick inside the huge bowl. But Jeez this is freaking GAS EXPENSIVE! I can't afford to create 19 objects if I wish one ticket to be 1,9x luckier! I ended up with 0,15 ETH gas expenses at only 26 gwei. This can't be the way. Any cooler ideas, maybe based on pure Maths instead of phisical creation of stuff?

Jan 4, 2024, 9:20 PM
Giving weights to the numbers on list should solve it no?
Jan 4, 2024, 11:34 PM
Gotta learn that. ChatGPT just gave me an example. I'll try today!
Jan 5, 2024, 8:38 AM

© 2024 Draquery.com All rights reserved.