मैं लेकिन मुझे 0 और 20 के बीच पूर्णांक संख्या मिलती है। मैं कैसे कर सकता हूं? मैंने भी एक और इंजन की कोशिश की: <पूर्व> लेकिन कुछ भी नहीं ... (हमेशा पूर्णांक मान) कैसे आप आउटपुट से पहले सटीक सेटिंग के बारे में? या उपयोग करें: उदाहरण <पूर्व> boost :: random पुस्तकालयों का उपयोग करके वास्तविक यादृच्छिक मानों को प्राप्त करने की कोशिश कर रहा हूं। यह मेरा कोड है:
#include & lt; iostream & gt; #include & lt; boost / random / uniform_real_distribution.hpp & gt; # शामिल करें & lt; boost / random / mersenne_twister.hpp & gt; Boost :: random :: mt19937 eng = boost :: random :: mt19937 (); को बढ़ावा देने :: यादृच्छिक :: uniform_real_distribution & LT; डबल & gt; Urd = boost :: random :: uniform_real_distribution & lt; डबल & gt; (0,20); के लिए (इंट आई = 0; आई & lt; = 100; i ++) std :: cout & lt; & lt; उरद (इंग्लैंड) & lt; & lt; std :: endl;
#include & lt; iostream & gt; #include & lt; boost / random / uniform_real_distribution.hpp & gt; # शामिल करें & lt; boost / random / lagged_fibonacci.hpp & gt; बढ़ावा :: यादृच्छिक :: lagged_fibonacci607 eng = boost :: random :: lagged_fibonacci607 (); को बढ़ावा देने :: यादृच्छिक :: uniform_real_distribution & LT; डबल & gt; Urd = boost :: random :: uniform_real_distribution & lt; डबल & gt; (0,20); के लिए (इंट आई = 0; आई & lt; = 100; i ++) std :: cout & lt; & lt; उरद (इंग्लैंड) & lt; & lt; std :: endl;
std :: cout.precision (15); ?
std :: cout.precision (std :: numeric_limits & lt; डबल & gt; :: digits10);
#include & lt; iostream & gt; # शामिल & lt; सीमाएं & gt; #include & lt; boost / random / uniform_real_distribution.hpp & gt; # शामिल करें & lt; boost / random / mersenne_twister.hpp & gt; Int main () {boost :: random :: mt19937 eng = boost :: random :: mt19937 (); को बढ़ावा देने :: यादृच्छिक :: uniform_real_distribution & LT; डबल & gt; Urd = boost :: random :: uniform_real_distribution & lt; डबल & gt; (0,20); std :: cout.precision (std :: numeric_limits & LT; डबल & gt; :: digits10); (इंट आई = 0; आई & lt; = 100; i ++) के लिए {std :: cout & lt; & lt; उरद (इंग्लैंड) & lt; & lt; std :: endl; }}
std :: cout के लिए डिफ़ॉल्ट परिशुद्धता
6 पर सेट है, इसलिए इसे सेट किए बिना काम करना चाहिए, लेकिन। ..
Comments
Post a Comment