Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4087922
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:54:58+00:00 2026-05-20T18:54:58+00:00

I am working a e-commerce website (in asp.net & c#) where which I want

  • 0

I am working a e-commerce website (in asp.net & c#) where which I want to implement a ‘Lucky draw’ functionality.The control flow would be like this :- the users will be buying a particular product on a day and I need to select a user from those who have purchased that product as the luck draw winner for the day.

My initial thought on implementing the lucky draw was to use the Random functions provided by C#.And there are lots of thoughts came in to my mind like ..

  1. How effective it would be if I only use the random functions in c#?
  2. Would it be better if I implement any random number generation algorithms for this purpose ?
  3. Is there any algorithms available for random selections from a group?

I am open to your valuable comments and suggestions.

Thanks
Alex

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:54:59+00:00Added an answer on May 20, 2026 at 6:54 pm
    1. The standard Random class should be enough, just make sure you use a unique seed everyday (say, a hash from every purchase data). Using time as seed (calling the Random constructor without parameter) could be bad if your app is always started in the exact same time everyday.
    2. The standard .NET library is good enough for statistical process. If you think you need stronger version, use the standard RNGCrypto library from .NET. Unless you got thousands of buyer everyday, I don’t think you really need the crypto version. Don’t implement an algorithm yourself. There’s a reason people use standardized random library, because it’s already tested against statistical requirement for randomness.
    3. Uhm… if you need to pick several lucky customers with equal probability, simply put them on a List, generate an integer between 0 and the List length. The integer you get is the first lucky customer, store it somewhere, remove it from the list, rinse and repeat for the next lucky customer.
      If you need to give higher probability according to their purchase count, store the purchase details instead of the customer inside the List. If you need custom weight according to the purchase value, use Fitness proportion, in which you total all purchase value for the day, then give each customer a cumulative value from their purchase. eg, if there are total $350 sale on that day, the first customer buying $75 got 75, the second customer buying $20 got 95 (75+20), the third customer buying $10 got 105 (95+10), etc. Then, pick a random integer between 0 and total sale, and the lucky winner is the customer with the lowest value that is still higher than the resulting integer. Remove the first winner from the list (both their total and position), rinse and repeat for the next customer.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on an C#/ASP.NET project that will host several differents e-commerce websites,
I am working on e-commerce application using asp.net MVC with C#. I need to
Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB.
Background: I'm working on an e-commerce website. It was my original intention to add
I am working with an artist to make her personal website. She would like
I am working an e-commerce site which will allow pdfs to be downloaded once
I am working on an e-commerce application where we want to charge the user
i am working on an e-commerce website using php. i have tried post/get and
I've been working through a fantastic book (Pro ASP.net MVC 2 Framework, Steven Sanderson)
Working on a legacy ASP.NET application we've found that ASP.NET session gets used for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.