Better Random Number

Bear with me here guys as I am dumping a lot of codes. Hopefully you guys are feeling generous and check it out to help a brother out. Any help would be greatly appreciated!
Last edited on
What's wrong with C++'s <random>? Simple C rand is a pretty weak rng, even if you juggle it a little.

About your error, it is pretty self explanatory, you need to define a conversion operator for your custom Double to POD double.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>

struct String
{
   std::string str;

   operator float() const
	{
	    return std::stof(str);
	}
};

int main()
{
	String s{ "1010" };
	float no = s;
	std::cout << no;

	return 0;
}


Outputs
1010
Last edited on
Okay, forget the error I was having trouble with. I think I fixed it.
As of now I have another problem.
Last edited on
I'm afraid we need a compilable or nearly compilable code to help you. It's really hard to guess all the missing part.
Sorry about that. I'm gonna edit it so it compiles. Thanks for pointing that out.
Topic archived. No new replies allowed.