blah icon indicating copy to clipboard operation
blah copied to clipboard

Random module

Open SushilRagoonath opened this issue 2 years ago • 3 comments

Hi, Any plans on adding noise/random sampling to this library?

SushilRagoonath avatar Jul 02 '22 08:07 SushilRagoonath

Yeah I'm into that idea. Realistically it would be a very simple/light pseudo number generator... I think if you want something really complex/thorough just using the standard library or an existing library specifically designed for that is probably best.

NoelFB avatar Jul 03 '22 00:07 NoelFB

Understood, The main reason I ask is that rand() from c doesn't produce very nice randomness and the c++ api is quite daunting. I usually rely on https://github.com/nothings/stb/blob/af1a5bc352164740c1cc1354942b1c6b72eacb8a/deprecated/stb.h#L8360 from stb.h Would perlin noise fall outside the range of this framework? I'm imaging an api like Random rand; rand.seed(seed) rand.int() rand.float() rand.perlin1d(x) rand.perlin2d(x,y) rand.perlin3d(x,y,z)

SushilRagoonath avatar Jul 03 '22 21:07 SushilRagoonath

yeah I think something like that sounds cool. I would realistically need to research algorithms to include, although I definitely agree a fast perlin would be super useful.

NoelFB avatar Jul 06 '22 19:07 NoelFB

This library has a bunch of nice stuff in it, might be a good source of inspiration https://github.com/andrewwillmott/distribute-lib

See Generate.h for a bunch of different random number and sequence generators

thomashope avatar Oct 19 '22 23:10 thomashope

Here's a really nice C/C++ random number solution. It produces pretty good numbers, and supports all the basic C types already: https://github.com/RandyGaul/cute_framework/blob/master/include/cute_rnd.h

At some point I'll definitely add perlin 1d, 2d and 3d. It's a bit low-priority but will happen at some point.

RandyGaul avatar Oct 29 '22 03:10 RandyGaul

Yeah this is really nice Randy! I'm not super sure yet but I'm currently of the opinion that it's probably best to keep things like number generators and so on up to existing libraries, and leave "blah" to just doing the core of what I need to get a game off the ground.

NoelFB avatar Oct 30 '22 00:10 NoelFB