05-03-2003, 12:03 AM

05-03-2003, 12:48 AM

Crappy but working

Code:

`DECLARE FUNCTION MyRandom% (Bottom%, Top%)`

DIM SHARED seed%

seed% = 0

FOR i& = 0 TO 100000

PRINT MyRandom%(0, 100);

NEXT

FUNCTION MyRandom% (Bottom%, Top%)

Range% = Top% - Bottom%

IF seed% < 1000 THEN seed% = 1000

value& = seed% \ 35: seed% = (value& * 37) AND 32767

t% = value& MOD Range%

MyRandom% = t% + Bottom%

END FUNCTION

05-03-2003, 01:50 AM

Interesting... but it is a pattern. If you could make it start in the a different place that would be cool.

05-03-2003, 02:43 AM

Code:

`DEFLNG A-Z`

a = TIMER

FOR j = 1 to 10

M = 10000

M1 = 100

b = 7821

p1 = a \ M1

p0 = a MOD M1

q1 = B \ M1

q0 = B MOD M1

c = (((p0 * q1 + p1 * q0) MOD M1) * M1 + p0 * q0) MOD M

a = (c + 1) MOD M

g = a \ M1

PRINT g

NEXT

(QBNews, Volume 2, Number 1 - February 28, 1991)

05-03-2003, 02:59 AM

Given a certain sequence of numbers [S], it has so far been difficult to create another two sequences [S1] and [S2] that represent the first sequence and a decoder with C being at its maximum in:

length[S] = length[S1] + length[S2] + C

Another difficult problem would be to find a sequence [S]. where sequence [S1a] and decoder [S2a] are the only two possible solutions to length[S] = length[S1] + length[S2] + C.

So, making a "true" random number sequence (one without any pattern) is really hard if not impossible. :")

length[S] = length[S1] + length[S2] + C

Another difficult problem would be to find a sequence [S]. where sequence [S1a] and decoder [S2a] are the only two possible solutions to length[S] = length[S1] + length[S2] + C.

So, making a "true" random number sequence (one without any pattern) is really hard if not impossible. :")

05-03-2003, 04:32 AM

I think Plasma357's works!

Edit:

Heres one that picks a number 1 through 100...

Edit:

Heres one that picks a number 1 through 100...

Code:

`CLS`

INPUT "Input max ", x

a$ = STR$(TIMER)

IF LEN(a$) < 7 THEN a$ = a$ + "0"

a$ = RIGHT$(a$, 2)

a = VAL(a$)

DO

IF a > x THEN a = a - x

IF a <= x THEN EXIT DO

LOOP

PRINT a

05-03-2003, 09:29 AM

Quote:So, making a "true" random number sequence (one without any pattern) is really hard if not impossible. :")

Don't crack your head, RND uses patterns too. At least in QB.

05-04-2003, 12:46 AM

I hear that nuclear decay can produce true random numbers somehow... anybody got a nuke in their backyard? Just hook it up to a COM port and write a QB app... :wink:

05-05-2003, 09:56 AM

Quote:I hear that nuclear decay can produce true random numbers somehow... anybody got a nuke in their backyard? Just hook it up to a COM port and write a QB app... :wink:

Nope. Nuclear decay means in itself a patterned decay.

ie: Val=Val-Val/2

BTW, val would be you elemental lifespan. Find "HalfLife" in the dictionary.

05-06-2003, 05:05 AM