• wpferreira01

    (@wpferreira01)


    Boa noite, estou com problemas para localizar um plugin ou algo que me ajude a criar um sistema de sorteio onde os membros cadastrados do site escolham ou até mesmo recebam números de 1 a 200 por exemplo para poderem participar do sorteio, já pesquisei de varias formas alguém tem alguma dica por favor.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I hope a reply in English is usable for you, my Portuguese is terrible.

    You can use the PHP function random_int() to get a random number in a given range. You could randomly pick a user by ID with this function. You only need to determine the current range of IDs. If the selected ID does not belong to a user, just keep getting another number until there is a match to a user ID.

    Some users may prefer to pick a number rather than just be randomly picked by computer. Their selection could be stored in user meta, then matched against the randomly generated number. With this scheme you may have multiple matches because users picked the same number.

    Or users could be assigned unique numbers different than their ID. It gets a little complicated ensuring all numbers are unique but are truly randomly assigned. It’s a lot easier to just pick a user by ID, but that takes the fun out of a random drawing.

    Whatever way you chose to do the drawing, the random_int() function will be a major part.

Viewing 1 replies (of 1 total)
  • The topic ‘Problema para localizar um plugin que me ajude’ is closed to new replies.