Giter Club home page Giter Club logo

probability's Introduction

Probability

확률을 구현하기 위한 클래스입니다.

Add

Probability<string> probability = new Probability<string>();
probability.Add("A", 1);
probability.Add("B", 2);
probability.Add("C", 3);
probability.Add("D", 4);
string random = probability.Get();

첫번째 인자에 타겟을,

두번째 인자에 확률을 추가하고

Get 혹은 InverseGet 함수를 통해 랜덤한 타겟을 가져옵니다.

Get

Get() 함수로 확률에 기반한 랜덤한 타겟을 가져옵니다.

Get(seed) 시드값을 넣어 항상 같은 결과를 얻을 수 있습니다.

Get 함수는 probability값을 모두 더한 총합에서 probability값의 가중치를 가집니다.

"A" : 10%

"B" : 20%

"C" : 30%

"D" : 40%

InverseGet

InverseGet() 함수로 가중치가 높을수록 확률이 낮은 랜덤한 타겟을 가져올 수 있습니다.

InverseGet(seed) 시드값을 넣어 항상 같은 결과를 얻을 수 있습니다.

InverseGet 함수는 1/probability값을 모두 더한 총합에서 1/probability값의 가중치를 가집니다.

"A" : 48%

"B" : 24%

"C" : 16%

"D" : 12%

probability's People

Contributors

solutena avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.