Multinomial Distribution in Unity?

Hi all,

I’m relatively new to Unity, but with a good deal of programming experience (though not in C#).

I was surprised to find that the Unity scripter only had a built in Uniform distribution, in the form of Random.Range. My question is regarding what the best way is to gain the use of other distributions. I’ve seen that some people have packaged up some in the Asset store; Gaussian, Exponential, but it’s the Multinomial I really want to be able to use.

Surely there must be a way to import other general C# packages? A bit of google-sleuthing suggested something called NuGet might be the way to go?

Very appreciative of any help anyone can provide. Many thanks, Thom

P.S. I’m only doing a few draws at a time so I can’t do a multivariate-normal approximation!

yep, NuGet is a popular package management system for Windows. It’s a .zip file at core, and can package up source or binaries. I’ve used it in unity via NugetForUnity, I believe.

.

This project seems to have specific non-nuget instructions in the README for Unity.

.

That said, a little web-searching suggests the MultiNomial isn’t that involved, and you might consider just implementing it yourself. That way you live to put off package management another day.

.

Another option, if you find a concise implementation in a git repository is to pull the repository in as a git submodule.

Not sure how the underlying distibution looks but Unity offers functions like Random.insideUnitCircle and Random.insideUnitSphere.

Other then that:

What exactly stops you from doing 2 consecutive drafts from a (for example) Gaussian Distribution to get a multidimensional value?