hi all, wanna to ask the subj. conventional randomness is enough, cause its not for crypto apps, but of course i wont mind and quite interested to discuss random for crypto further, and i'm pretty sure that we will need it someday. say the mcu is the infamous PIC . how you manage to get it? by software/hardware? or both?

btw, i had a little confused on how can someone setting difficulty on somekind of probability amusement machine? i.e easy, medium, hard, so on. say i have had the random source, then what should i do to provide this kind of probability setting?

thanks a bunch
Posted on 2003-04-17 21:28:22 by dion

btw, i had a little confused on how can someone setting difficulty on somekind of probability amusement machine? i.e easy, medium, hard, so on. say i have had the random source, then what should i do to provide this kind of probability setting?
The random value is somehow clipped. A divide is typical. For example, if you have a 32 bit random number then each possible outcome has a chance of 1/(2^32). If you divide that 32 bit number by (2^32)/10 the output is reduced to a value between 0 and 9 -- a one in ten chance. The other questions are out of my range of knowledge.
Posted on 2003-04-17 21:34:19 by bitRAKE
thanks for that part, bitRAKE, i understand now :grin:
Posted on 2003-04-17 21:42:33 by dion
uhm... is there someone assume that i had closed this thread???
or this topic is too hard to...
Posted on 2003-04-24 06:03:51 by dion

The random value is somehow clipped. A divide is typical. For example, if you have a 32 bit random number then each possible outcome has a chance of 1/(2^32). If you divide that 32 bit number by (2^32)/10 the output is reduced to a value between 0 and 9 -- a one in ten chance. The other questions are out of my range of knowledge.


Aren't you supposed to multiply then divide? Something like random(0 -> 2^32) * 10/(2^32) so you have a random number from 0 to 9.
Posted on 2003-04-24 20:53:17 by AmkG
(0 -> 2^32) * 10/(2^32) ???
would it be the same like (value * 10)?
Posted on 2003-04-25 07:52:35 by dion
okay, i read about generating a pseudo random sequencer, which is using series of d flip flop with common clock, and using one/two gate to form a somekind of feedback from last one to the first. is there any other method, not using a chip, but using cap/transistor/whatever?

thanks
Posted on 2003-05-08 06:06:02 by dion
I have a code snippet for the PIC16F628, I hope this helps Dion, take a look at it:




;Code list obtained from piclist.com, obtains a random number

LFSR: RLF RANDOM,W
RLF RANDOM,W
BTFSC RANDOM,4
XORLW 1
BTFSC RANDOM,5
XORLW 1
BTFSC RANDOM,3
XORLW 1
MOVWF RANDOM
RETLW 0


Its for the 16F628 but you can probably convert it :D
Posted on 2003-05-08 18:15:27 by x86asm

(0 -> 2^32) * 10/(2^32) ???
would it be the same like (value * 10)?


Yes, where value is a number from 0 -> 1 (well, not inclusive of 1 anyway, so more accurately it is 0 <= value < 1). Remember, we want a number from 0 to 9 inclusive.
Posted on 2003-05-08 21:49:44 by AmkG
thanks guys for replied :grin:

x86asm: uhmm... can i ask something here, because i dont familiar with pic mnemonic, which mnemonic that producing the seed/randomness?
Posted on 2003-05-10 08:34:14 by dion

thanks guys for replied :grin:

x86asm: uhmm... can i ask something here, because i dont familiar with pic mnemonic, which mnemonic that producing the seed/randomness?


sorry for posting it it was kind of irrelevant I thought you were looking to generate a random number (but you want to generate seed). It was a late night post :)
Posted on 2003-05-11 12:24:05 by x86asm

sorry for posting it it was kind of irrelevant I thought you were looking to generate a random number (but you want to generate seed). It was a late night post :)


???

but you got the random number from the seed, am i wrong here???
if i'm wrong, then ignore that. change the question to: which opcode generating the random number? is there an equal one in 8051, if anyone know? actually i want hardware solution for this, btw.
Posted on 2003-05-12 06:08:46 by dion
hi all, i just search a while n found this http://www.pjrc.com/tech/8051/rand.asm]:



;to use these pseudo-random number sequence generators, memory must be
;set aside to hold the last random number, which is used to generate the
;next one so that a randomly distributed (but predictable) sequence of
;number is generated. .equrand8reg, 0x20;one byte
.equrand16reg, 0x21;two bytes ;generates an 8 bit pseudo-random number which is returned in Acc.
;one byte of memory must be available for rand8reg rand8:mova, rand8reg
jnzrand8b
cpla
movrand8reg, a
rand8b:anla, #10111000b
movc, p
mova, rand8reg
rlca
movrand8reg, a
ret


now, i dont understand why someone would doing a random which is predicable, afaik, random is defined as an unpredictable behaviour, so if its predictable, then its NOT a random whatever it called pseudo or not. any other one?
Posted on 2003-05-28 07:31:10 by dion