mercredi 1 avril 2020

C++ Return (uniform_int_distribution) from a function

I made this random class so I can use random numbers in my game engine whenever I need, but I'm having a problem with the functions, How I'm I suppose to return R ? (please keep in mind that I'm new to coding in general)

#pragma once
#include <ctime>
#include <random>

using namespace std;

class Random
{
private:


public:
    Random() { default_random_engine RandomNumber(time(0));};

    int RandomNumber()
    {
        uniform_int_distribution<int> R();
         return = R;
    }

    float RandomFloat()
    {
        uniform_int_distribution<float> R();
    }

    int RandomNumberRange(int Min =0,int Max =0)
    {
        uniform_int_distribution<int> R(Min,Max);
    }

    float RandomFloatRange(float Min = 0, float Max = 0)
    {
        uniform_int_distribution<float> R(Min,Max);
    }}; 



Aucun commentaire:

Enregistrer un commentaire