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

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

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 for that part, bitRAKE, i understand now :grin:

uhm... is there someone assume that i had closed this thread???

or this topic is too hard to...

or this topic is too hard to...

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.

(0 -> 2^32) * 10/(2^32) ???

would it be the same like (value * 10)?

would it be the same like (value * 10)?

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

thanks

I have a code snippet for the PIC16F628, I hope this helps Dion, take a look at it:

Its for the 16F628 but you can probably convert it :D

```
```

;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

(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.

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?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 :)

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.

hi all, i just search a while n found this http://www.pjrc.com/tech/8051/rand.asm]:

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?

```
```

;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?