Resolved Falsification of probability

DANILIN

Active member
Joined
Oct 19, 2018
Messages
44
Programming Experience
10+
Falsification of probability

exploring possibility of falsification of random
qbasic qb64 programs were created in an hour
and a table using formulas

= CASEBETWEEN(0;1)
= IF (B3 = B2; C2 + 1; 0)
= COUNTIF (C$3: C$55000; D2)
= SUM(E2:E10)
= E2 / E3

randus012.png


idea: fake a 50% chance

results:

research E green pure excel:
randomly distributed naturally

research 0 yellow qb 0:
randomly distributed naturally

research 1 in red qb 1:
explicit fake equal number in a row

research 2 violet qb 2:
smart fake but not all programmed
and skew due to algorithm

Conclusion: identify fake random real

Visual Basic:
' 0.bas
OPEN "0.txt" FOR OUTPUT AS #1
FOR s = 1 TO 50000: PRINT #1, (INT(RND * 1000) MOD 2): NEXT
CLOSE
Visual Basic:
' 1.bas
OPEN "1.txt" FOR OUTPUT AS #1
FOR d = 1 TO 5: FOR s = 1 TO 100
FOR i = 1 TO s: PRINT #1, 1: NEXT
FOR i = 1 TO s: PRINT #1, 0: NEXT
NEXT: NEXT: CLOSE
Visual Basic:
' 2.bas
OPEN "2.txt" FOR OUTPUT AS #1
FOR k = 1 TO 100: FOR s = 1 TO 7
FOR d = 1 TO 2 ^ (7 - s)
FOR i = 1 TO s: PRINT #1, 1: NEXT
FOR i = 1 TO s: PRINT #1, 0: NEXT
NEXT: NEXT: NEXT: CLOSE

sequence fake shuffled
turns into a random sequence

and began to correspond to distributions

falsernd33.gif


and excel more clearly than programs
but c# synthesis programs are possible online


using a random synthesis program
and dividing into small 0 and large 1
synthesized 55000 random and tested

despite normality of number of consecutive 0...7
a larger number in a row is not possible
therefore sequence is worse than usual rnd

Visual Basic:
'rndxx.bas
OPEN "rndxxx.txt" FOR OUTPUT AS #1

FOR i = 1 TO 55555: r = Rand
IF r < 0.5 THEN PRINT #1, 0 ELSE PRINT #1, 1
'IF r <= 0.5 THEN PRINT #1, 0 ELSE PRINT #1, 1
'IF r <= 0.7 THEN PRINT #1, 0 ELSE PRINT #1, 1
NEXT: CLOSE

FUNCTION Rand: STATIC Seed
x1 = (Seed * 214013 + 2531011) MOD 2 ^ 24
Seed = x1: Rand = x1 / 2 ^ 24
END FUNCTION

rndxx.png


in C# randomness is also low-power
I suppose understood by people as supposedly normal

C#:
using System;using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Rextester
{ public class Program
    { public static void Main(string[] args)
        { Random rand = new Random();
for (int i = 1; i < 5555; i++)
{ var d = rand.Next(2);
if (d<0.5)
    Console.WriteLine("0");
     else Console.WriteLine("1");
}}}}

on-line compiler: DANILIN probability, C# - rextester

significant reliable probability: shuffled
that is: 2-sided and that is: integraly probability

Program peretas.bas creates a sequence
random a: 0 and 1 by manual algorithm from Internet

and program creates random d: 0 ... 77777
for shuffling and sorting an array d array a is ordered
and perhaps against repetition it is better to shuffle cards 1000000

Visual Basic:
'peretas.bas
DIM a(55555), d(55555)

OPEN "aa.txt" FOR OUTPUT AS #1: OPEN "dd.txt" FOR OUTPUT AS #2
OPEN "aaaa.txt" FOR OUTPUT AS #3: OPEN "dddd.txt" FOR OUTPUT AS #4

FOR i = 1 TO 55555: r = Rand: a(i) = INT(r * 2): PRINT #1, a(i): NEXT
FOR i = 1 TO 55555: r = Rand: d(i) = INT(r * 77777): PRINT #2, d(i): NEXT

FOR i = 1 TO 55554: FOR j = i TO 55555
IF d(i) > d(j) THEN SWAP d(i), d(j): SWAP a(i), a(j)
NEXT: NEXT

FOR i = 1 TO 55555: PRINT #3, a(i): PRINT #4, d(i): NEXT
CLOSE

FUNCTION Rand
STATIC Seed
x1 = (Seed * 214013 + 2531011) MOD 2 ^ 24
Seed = x1
Rand = x1 / 2 ^ 24
END FUNCTION

Theoretical values in Excel Excel via formulas

=C3/2
=D3+C4
=D4*55000

show: out of 55000 for 7 steps covered 54570
numbers in their sequences
and probably deviation betrays a false accident

and shuffling involved 54885 close to theory

Theoretical values in Excel Excel via formulas



fldelen.gif
 
In your VB implementation of an LCG, can you explain your choice of using 24 bits? Those main numbers are associated with the MS VB algorithm for generating random numbers, but in the case of the MS LCG, they use 31 bits for the next state, but only return the lower 16 bits as the random number.
 
Last edited:
In post #3 of that thread, Steve ends up saying the constants used in post #1 were not actually being used. Instead it was using constants that were using 32 bits. He then later adds on some BASIC code asking people to test the 24-bit version.
 
my achievements basic & excel & c#
write to disk and then combine as big data
or print to screen in online compiler

to check c # program
I need to first understand how to attach a function

ideone.com/lgxbXJ

C#:
using System;using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Rextester
{ public class Program
    { public static void Main(string[] args)
        { Random rand = new Random();
for (int i = 1; i < 55; i++)
{ double d = rand.Next(2);
Console.WriteLine(Math.Ceiling(d));
}}}}


C#:
float func_rnd(float n,int32 passed){
    if (new_error) return 0;
   
    static uint32 m;
    if (!passed) n=1.0f;
    if (n!=0.0){
        if (n<0.0){
            m=*((uint32*)&n);
            rnd_seed=(m&0xFFFFFF)+((m&0xFF000000)>>24);
        }
        rnd_seed=(rnd_seed*16598013+12820163)&0xFFFFFF;
    }     
    return (double)rnd_seed/0x1000000;
}

what will happen by january
for author of function and like-minded people
it’s easier to introduce my design
what i will inform at this time on that forum

be sure to provide a link to this topic

script for online compiler:
a vertical chain of 0 or 1 is created
quantity minimum 55555 and for checking 55 pieces

if program returns a random 0<rand<1
then turns to comparing with 0.5
or use formula: integer from: random + 0.5

so you get a universal shell
and it is possible to apply other functions of random online

online compilers C#:
 
Last edited:
C# has methods, not functions. The func_rnd() you have above is a C function. You have to re-write it into C#. Above you said that you know C#, so you should know that code there will not work as is.

Also, in the .NET Framework Random.Next() returns an integer, why are you treating the return value as a floating point number?
 
Last edited:
Also, if you want to see how C# generates random numbers, you can see the code at:
 
Check for randomness of digits of number of PI

Using 55,000 digits of pi
first in Word translated to column by replacement
Excel compiles formulas for dividing into:
even \ odd and small \ big

and then my tables are used
at same time comparing with theoretical separation

Results: average for both divisions: 0.5
and separation matches chance by true
and it’s still possible to shuffle
and it’s still possible to explore other constants and roots

pi55.png


raspred.png


Meaning of task: true chance for people is unnatural
and it is possible to synthesize low-power human probabilities

But if we are talking about overcoming chance
understanding wave of probability increases reliability

Probability waves increase reliability:
my development of past 10th anniversary
 
Last edited:
Invented by me at random algorithm of RNG
where is trigonometry used

check shows distribution is bad
comparing even\odd and small\large
but shuffling turns array into a normal one

I came up with an algorithm Blizzard at school
in last century even under old regime and in our century
about same too foreign called vortex

Blizzard algorithm: number 1 is random and is added
random increment and control range
and if necessary controlled repetition of numbers

Visual Basic:
'VYUGA.bas
DIM a(55555)
RANDOMIZE TIMER: CLS
OPEN "VYUGA.txt" FOR OUTPUT AS #1
d=37
a(1) = INT(RND*d)+1
PRINT #1, a(1)
FOR i = 2 TO 55555
    a(i) = a(i-1) + INT(RND*3*d)+1
    22 IF a(i) > d THEN a(i) = a(i)-d: GOTO 22
    PRINT #1, a(i)
NEXT
Ideone.com
C#:
//VYUGA.cs
using System;using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace VYUGA
{ public class Program
    { static double w; 
	static void Main(string[] args) 
        { Random rand = new Random();
int d=37;
double s = rand.Next(5000000);
double a = Math.Round(d*s/5000000)+1;
Console.WriteLine(a);

for (int i = 1; i < 255; i++)
{ w = rand.Next(3000000)+1;
double v = Math.Round(w*d/1000000)+1;
a=a+v;
da: if (a>d) 
{ a=a-d; goto da; }
Console.WriteLine(a);}
Console.ReadKey(); }}}
check shows distribution is good
comparing even\odd and small\large

and a Blizzard suddenly makes normal randomness trigonometric

therefore I am looking
for an algorithm of form Mersenne twister c# & qbasic

Nearest step: by weak algorithm shuffling
of weak randomness is randomness of normal
 
Last edited:
As for your C# code above, why not just change this:
C#:
a=a+v;
da: if (a>d) 
{ a=a-d; goto da; }
to
C#:
a=(a+v) % (d+1);
 
Nearest step: shuffling by weak algorithm
weak randomness is randomness of normal

Sequence is bad
and inserted into Excel in 2 columns at a distance
and to left end-to-end of 2nd column is a column of numbers in a row
and columns are sorted end to end from maximum to minimum

Grouped together: reverse and forward sequences
and then sort both by ordering reverse
sequence is shuffled simultaneously.

Test shows normality of a shuffled
sequences of even\odd and large\small

An automatic algorithm without rnd reads array straight
and immediately there is an array reverse: ... it's a computer ...

Sorting reverse array shuffles forward array
and it turns out sequence is normal

Visual Basic:
'tasov.bas
DIM a(55000), d(55000)
OPEN "aa.txt" FOR INPUT AS #1
OPEN "dd.txt" FOR OUTPUT AS #2

FOR i = 1 TO 55000
    INPUT #1, a(i): d(55000 - i + 1) = a(i):NEXT

FOR i = 1 TO 54999: FOR j = i TO 55000
        IF d(i) > d(j) THEN SWAP d(i), d(j): SWAP a(i), a(j)
NEXT: NEXT

FOR i = 1 TO 55000: PRINT #2, a(i): NEXT: CLOSE
 
This is a C# forum, not a VBA/VB forum. What is the equivalent in C#? Its generally only acceptable to post VB code providing its accompanied with C# code too. Just thought I'd point that out.
 
Back
Top Bottom