none
Getting started with my first functional C# application Lottery Application RRS feed

  • Question

  • Good day, my name is Adam and I would like to learn C# programming and I've already gone through the UDEV Bob Tabor tutorial. So I just want someone to help me give me the code to build a very detailed and presentable C# application for the South African Lottery.

    So what I would like for it to have is it should be an application that selects random numbers from one to 49 but also one which works according to numbers that commonly appear for example lets say 5 appeared 10 times and 13 appeared twice already I should be able to feed that into the application to change the probability of it appearing again.

    Thank you immensely for your help because programming seems really hard for me and I believe the best way for me to learn is by designing applications myself.

    One more request if it's not too much trouble could you people tell me how you learnt programming so I can fast track my success because I've become stagnant. Unfortunately I don't have money to pay for any courses so please keep that in mind.

    Yours thankfully,

    Adam

     
    Friday, May 31, 2019 12:05 PM

All replies

  • In regards to question 1, look to see what others have done, they may not be exact but can lead you down the correct path.

    Some examples

    https://jbwyatt.com/Code/Csharp/code/GW/lottery.html

    https://www.danielwjudge.com/lottery-simulator-in-c/

    Question 2, start with learning how to work with strings, numeric, dates, arrays and list for starters. Then learn how to do logical flows e.g. if, while for etc. Keep away from user interfaces at first as they muddy the waters and take away from learning the above.

    When learning the above try to get things working then break them as you need to know how to handle the unexpected too.

    When doing so I recommend either console or unit test projects. What you should avoid is starting off with an application, instead learn the basics. Where to learn from? There are many places on the web to learn from, some okay, some bad, some good coupled with getting a style that works well for you.

    Take you time through the learning process and keep at it until you have a firm grasp on each topic.

    Resources

    https://www.w3resource.com/csharp-exercises/

    https://www.amazon.com/C-7-0-Nutshell-Definitive-Reference/dp/1491987650

    https://mva.microsoft.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-16169?l=Lvld4EQIC_2706218949

    https://stackify.com/learn-c-sharp-tutorials/


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange


    Friday, May 31, 2019 12:43 PM
    Moderator
  • I do want to clear up a fundamental misunderstanding of your problem domain.

    Are you trying to "beat" the South African Lottery?  Because that's impossible.  Random numbers have provable mathematical properties.  Any random number generator used by a genuine lottery service is NOT going to have numbers "commonly appear".  There will not be patterns.  The fact that 5 appeared 10 times is absolutely no indication of how often 5 will appear in the future.  A lottery that did so would be quickly sued out of business.

    Look at Keno, which is exactly the same as a lottery.  Las Vegas casinos have been doing Keno draws 10 times per hour, 24 hours a day, 365 days a year, for a century.  Despite a mountain of statistical observations and analysis, there are no "winning systems" for Keno, and you will not find a "winning system" for something that does 2 draws a week.

    Having said that, working with random numbers can be fun.  One of the things about keno/lottery games is that you can't just choose 6 values between 1 and 49, because once you have drawn a number, it can't be chosen again.  Once common method is to "shuffle" the balls like a deck of cards (and there are good an uncomplicated algorithms for doing a shuffle), then just pull the top six values.  That wouldn't account for your bias, but it would be a good place to start.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Friday, May 31, 2019 6:12 PM
  • An unprobability-engine? 

    This should be possible to progam but you need to lay down some pseudocode/ the math on how it works statistically first.

    The key is: how much does f.eks the probability of choosing 42 decrease for each time you get a 42?


    • Edited by ThisNewbie Wednesday, June 19, 2019 7:31 AM
    Wednesday, June 19, 2019 7:27 AM
  • > The key is: how much does the probability of choosing 42 decrease for each time you get a 42?

    That's easy.  The answer is 0.  The numbers chosen today have no impact on the distribution of future choices.  It MUST be that way.  Any lottery system that didn't have that attribute would be unfair.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Thursday, June 20, 2019 3:56 AM
  • Hi Adam

    You need to write a system that tracks the history of all the lotto draws.

    Track all statistics, such as

    how many times a ball has been drawn

    how many weeks it has been out

    how many odd / even balls per draw 

    how many low / high number per draw

    the difference between the Last and First Ball (numerically)

    Friday, August 2, 2019 1:17 AM
  • I read the description of problem and think he wants to build an unfair lottery system.

    It could be fun to write something like this (I think I've read some paper on this topic around 2016, possibly there are earlier publications too), but not fun when you know it would be put into production use. So I don't have any intention to help this one.


    Friday, August 2, 2019 1:33 AM
    Answerer