From mboxrd@z Thu Jan 1 00:00:00 1970 From: wudmx@web.de (Andreas Leppert) Date: Sun, 30 Jan 2011 00:49:10 +0100 Subject: Creating the same random numbers In-Reply-To: <1041152607-1296331182-cardhu_decombobulator_blackberry.rim.net-897203629-@b27.c7.bise7.blackberry> References: <20110129140936.GA3225@yoda> <1041152607-1296331182-cardhu_decombobulator_blackberry.rim.net-897203629-@b27.c7.bise7.blackberry> Message-ID: <20110129234909.GD3225@yoda> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Sat, Jan 29, 2011 at 07:59:34PM +0000, creslin at gmail.com wrote: > But in short answer yes, if you use the same seed the same answer > would be generated, assuming no further entropy is used later I.e > dependent on method employed to expand. Though then the 'randomness' > is in the seed not the output. Its this capability which allows simple > access control token devices to operate. > I'm not quite familiar with the number generators in the kernel. Right now I do this to get a random number betwen min and max: /* compute the random value within the given min and max wrt to step */ int tmp_bytes, range; range = max - min + 1; get_random_bytes(&tmp_bytes, sizeof(tmp_bytes)); if (0 > tmp_bytes) tmp_bytes = -tmp_bytes; new_random_param->curval = tmp_bytes % range + min; You mentioned the seed value. Is there a way to set a seed value before I invoke get_random_bytes? Could you direct me to a page / source file where I can get more information about it? Thanks for all responses so long! Andreas Leppert