unblest Posted April 25, 2015 Share Posted April 25, 2015 Hello. I tried searching randomint on the nexus forums but none seems to give me a clear answer.According to creationkit's reference http://www.creationkit.com/RandomInt_-_Utility utility.randomint for example utility.randomint(0,5) would return one value from set of integers {1,2,3,4,5}, but is {0} included as well and return one from {0,1,2,3,4,5}? I'm asking this because I've seen tons of mods that uses randomint(x, y) as if x is exclusive Link to comment Share on other sites More sharing options...
unblest Posted April 25, 2015 Author Share Posted April 25, 2015 Answering my own question, but I ran scriptname myfirstscript extends questEvent OnInit()string final = ""string random = ""int i=10while i>0random = utility.randomint(0,5) as stringfinal = final+", "+randomi -= 1endwhile Debug.Notification(final)EndEvent and string final does include 0 Link to comment Share on other sites More sharing options...
grc472 Posted May 17, 2015 Share Posted May 17, 2015 So, does RandomInt() generate a uniform distribution? What about RandomFloat()? I was hoping to find a utility function to generate a normal (Gaussian) distribution, where I initialize it with a seed value and a standard deviation. Does such an API exist or am I SOL? Link to comment Share on other sites More sharing options...
FrankFamily Posted May 17, 2015 Share Posted May 17, 2015 I think both are uniform and as far as i know there's no normal distribution thing for papyrus. Link to comment Share on other sites More sharing options...
TrollAutokill Posted February 28, 2021 Share Posted February 28, 2021 (edited) So, does RandomInt() generate a uniform distribution? What about RandomFloat()? I was hoping to find a utility function to generate a normal (Gaussian) distribution, where I initialize it with a seed value and a standard deviation. Does such an API exist or am I SOL?Sorry for digging up an old thread, but I had the same question some time ago. To get a (pseudo) normal distribution you just need to sum at least 4 flat distributions. For example if you want a Gaussian-like distribution between 0 and 100 you would do something like float x = Utility.RandomFloat(0,25)+Utility.RandomFloat(0,25)+Utility.RandomFloat(0,25)+Utility.RandomFloat(0,25); Edited February 28, 2021 by TrollAutokill Link to comment Share on other sites More sharing options...
Recommended Posts