Use std::uniform_int_distribution and define its range later

后端 未结 3 951
遇见更好的自我
遇见更好的自我 2020-12-19 18:23

I have problem where I want to create a std::uniform_int_distribution in a struct and then give its range later. Below is what I want.

#include          


        
3条回答
  •  萌比男神i
    2020-12-19 19:00

    You should do

    group.dis = std::uniform_int_distribution<>(0,19);
    

    instead of

    group.dis(0,19);
    

    Also, your code seems to be taken without reference directly from here, so a link as kind of a tributal citation would have been in order.

提交回复
热议问题