logo
down
shadow

c++ generate a good random seed for psudo random number generators


c++ generate a good random seed for psudo random number generators

By : user3865370
Date : January 10 2021, 01:57 PM
I think the issue was by ths following , The code that reads from /dev/random seems wrong: you're C-style casting the address of your character buffer into random_seed_a (plug for C++ casts here) and ignoring anything you actually read from /dev/random (try *reinterpret_cast(memblock).
/dev/random should already be a good entropy source, so if it's available don't possibly taint the value with any other data and just use it as the seed directly. If there isn't enough data in /dev/random I would just fall back on the time and use that by itself rather than xor'ing it with something.
code :


Share : facebook icon twitter icon
How to set a unified seed for random number generators in MATLAB?

How to set a unified seed for random number generators in MATLAB?


By : user3034851
Date : March 29 2020, 07:55 AM
Any of those help Normally code would use Matlab's built-in random number generator. You can seed it with the following:
code :
rng         = RandStream.getDefaultStream;
rng.reset(your_seed_value_here);
How to generate good random seed for a random generator?

How to generate good random seed for a random generator?


By : Haruki Asatani
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further If in any doubt, get your seed from CryptGenRandom on Windows, or by reading from dev/random or dev/urandom on *NIX systems.
This might be overkill for your purposes, but unless it causes performance problems there's no point messing with low-entropy sources like the time.
Seed a pool of random number generators with a random number generator

Seed a pool of random number generators with a random number generator


By : user3033978
Date : March 29 2020, 07:55 AM
this one helps.
Does using a rng to seed a pool of rngs create some kind of bias? If it depends on which rng is used (and it probably does), which one should i use?
Should I use `random.seed` or `numpy.random.seed` to control random number generation in `scikit-learn`?

Should I use `random.seed` or `numpy.random.seed` to control random number generation in `scikit-learn`?


By : PanXiaoliang
Date : March 29 2020, 07:55 AM
hope this fix your issue I'm using scikit-learn and numpy and I want to set the global seed so that my work is reproducible. ,
Should I use np.random.seed or random.seed?
What is a good way to seed parallel pseudo random number generators?

What is a good way to seed parallel pseudo random number generators?


By : Dario
Date : March 29 2020, 07:55 AM
Hope that helps
I can possibly change my PRNG, if there's one which is specifically designed and well suited for parallel random number generation
Related Posts Related Posts :
  • Sort an array via x86 Assembly (embedded in C++)?? Possible?
  • How to Replace only Part of the Variable using #define
  • How do you compare the performace of valarrays vs built-in arrays?
  • Is it normal for C++ static initialization to appear twice in the same backtrace?
  • Why isn't my operator overloading working properly?
  • Getting meaningful error messages from fstream's in C++
  • C++: Converting Julian dates to Gregorian
  • Could someone explain this interesting behaviour with Sleep(1)?
  • Is it possible to roll a significantly faster version of modf
  • Updating pointer using signals and slots
  • How are classes more secure than structures?
  • finding "distance" between two pixel's colors
  • C++ Greatest Number Verification
  • Why does my token return NULL and how can I fix it?(c++)
  • C++ enforce conditions on inherited classes
  • what happened if an exception is not captured?
  • Redundant naming in C/C++ typedefs/structs
  • question about STL thread-safe and STL debugging
  • killing a separate thread having a socket
  • Returning the size of available virtual memory at run-time in C++
  • Parallel computing for integrals
  • How do I force my std::map to deallocate memory used?
  • C++ Templates: implicit conversion, no matching function for call to ctor
  • Adding python script to c++ project
  • C++ private pointer "leaking"?
  • Initializing Primitive Array to One Value
  • how is push_back implemented in STL vector?
  • C++ Profiling: KiFastSystemCallRet
  • Multiple rows with a single INSERT in SQLServer 2008
  • Use super class's address/pointer in initialization list
  • double fork using vfork
  • Convert char pointer (char*) to struct
  • Does anyone have good tips for using pc-lint?
  • C++ How fast is passing around objects?
  • template type's ctor arguments at instantiation time
  • Get list of windows in taskbar on Windows 7?
  • Curl connection options
  • Best cross-platform solution for network server?
  • simple c++ file opening issue
  • Switching from C++ (with a lot of STL use) to C for interpreter building
  • How can I access the JPEG image pixels as a 3D array like we do in MATLAB?
  • What wording in the C++ standard allows static_cast<non-void-type*>(malloc(N)); to work?
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk