prng

What's the origin of this GLSL rand() one-liner?

旧巷老猫 提交于 2019-11-28 14:23:23
问题 I've seen this pseudo-random number generator for use in shaders referred to here and there around the web: float rand(vec2 co){ return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); } It's variously called "canonical", or "a one-liner I found on the web somewhere". What's the origin of this function? Are the constant values as arbitrary as they seem or is there some art to their selection? Is there any discussion of the merits of this function? EDIT: The oldest reference to this

differences between random and urandom

≯℡__Kan透↙ 提交于 2019-11-27 19:59:05
问题 I'm trying to find out the differences between /dev/random and /dev/urandom files What are the differences between /dev/random and /dev/urandom ? When should I use them? when should I not use them? 回答1: Using /dev/random may require waiting for the result as it uses so-called entropy pool , where random data may not be available at the moment. /dev/urandom returns as many bytes as user requested and thus it is less random than /dev/random . As can be read from the man page: random When read,

Random Number Generator in CUDA

跟風遠走 提交于 2019-11-27 12:26:35
问题 I've struggled with this all day, I am trying to get a random number generator for threads in my CUDA code. I have looked through all forums and yes this topic comes up a fair bit but I've spent hours trying to unravel all sorts of codes to no avail. If anyone knows of a simple method, probably a device kernel that can be called to returns a random float between 0 and 1, or an integer that I can transform I would be most grateful. Again, I hope to use the random number in the kernel, just

Do stateless random number generators exist?

ぐ巨炮叔叔 提交于 2019-11-27 02:04:22
Is there a difference between generating multiple numbers using a single random number generator (RNG) versus generating one number per generator and discarding it? Do both implementations generate numbers which are equally random? Is there a difference between the normal RNGs and the secure RNGs for this? I have a web application that is supposed to generate a list of random numbers on behalf of clients. That is, the numbers should appear to be random from each client's point of view. Does this mean I need retain a separate random RNG per client session? Or can I share a single RNG across all

SecureRandom with NativePRNG vs SHA1PRNG

廉价感情. 提交于 2019-11-26 22:47:35
问题 I need to generate cryptographically strong random numbers and byte arrays. For this purpose, I'm using Java's SecureRandom class. But I'm not sure to choose which PRNG algorithm in terms of their cryptographic strength. Which of the following instances generates a more unpredictable numbers? Or are they equal? SecureRandom nativePrng = SecureRandom.getInstance("NativePRNG") SecureRandom sha1Prng = SecureRandom.getInstance("SHA1PRNG") Moreover, we are able to generate these instances with

True random number generator [closed]

僤鯓⒐⒋嵵緔 提交于 2019-11-26 17:36:12
Sorry for this not being a "real" question, but Sometime back i remember seeing a post here about randomizing a randomizer randomly to generate truly random numbers, not just pseudo random. I dont see it if i search for it. Does anybody know about that article? I believe that was on thedailywtf.com - ie. not something that you want to do. It is not possible to get a truly random number from pseudorandom numbers, no matter how many times you call randomize(). You can get "true" random numbers from special hardware . You could also collect entropy from mouse movements and things like that. I

Reversible pseudo-random sequence generator

无人久伴 提交于 2019-11-26 14:37:51
I would like some sort of method to create a fairly long sequence of random numbers that I can flip through backwards and forwards . Like a machine with "next" and "previous" buttons, that will give you random numbers. Something like 10-bit resolution (i.e. positive integers in a range from 0 to 1023) is enough, and a sequence of >100k numbers. It's for a simple game-type app, I don't need encryption-strength randomness or anything, but I want it to feel fairly random. I have a limited amount of memory available though, so I can't just generate a chunk of random data and go through it. I need

Do stateless random number generators exist?

萝らか妹 提交于 2019-11-26 09:53:47
问题 Is there a difference between generating multiple numbers using a single random number generator (RNG) versus generating one number per generator and discarding it? Do both implementations generate numbers which are equally random? Is there a difference between the normal RNGs and the secure RNGs for this? I have a web application that is supposed to generate a list of random numbers on behalf of clients. That is, the numbers should appear to be random from each client\'s point of view. Does

Reversible pseudo-random sequence generator

不问归期 提交于 2019-11-26 05:56:35
问题 I would like some sort of method to create a fairly long sequence of random numbers that I can flip through backwards and forwards . Like a machine with \"next\" and \"previous\" buttons, that will give you random numbers. Something like 10-bit resolution (i.e. positive integers in a range from 0 to 1023) is enough, and a sequence of >100k numbers. It\'s for a simple game-type app, I don\'t need encryption-strength randomness or anything, but I want it to feel fairly random. I have a limited

True random number generator [closed]

旧街凉风 提交于 2019-11-26 05:29:19
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Sorry for this not being a \"real\" question, but Sometime back i remember seeing a post here about randomizing a randomizer randomly to generate truly random numbers, not just pseudo random. I dont see it if i search for it. Does anybody know about that article? 回答1: I believe that was on thedailywtf.com - ie.