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 ..
I am open to your valuable comments and suggestions.
Thanks
Alex
C# has no random functions. It gives you access to the .NET libraries.
Don't use Math.Random
. Do use one of the crypto RNGs that are provided by the .NET BCL. If you're doing this once or twice per day, the extra complexity of the crypto-strength RNG won't be a problem.
In my opinion, its up to number of person you can select. If its just one, I would use Random() or as Ben Voigt suggested .
If its more complex lucky draw, you might need help from Combinations and Permutations algorithms.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.