It is currently 12 Aug 2020, 14:18

The Lottery Forum - Lottery Generators
• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

The lottery forum section of gimplearn.net will be here for historical purposes, as we have
created a brand new stand-alone forum at https://gimplearn.net/thelotteryforum/.
Please try to register and post there instead

TLF Topics: Active | Unanswered | Random
TLF Posts: Unread | New | Random
Lottery Forum
     Lottery/General Program Requests | Lottery Generators |🡆 Lottery CodeSkulptor Programs
     General Programs
     Chit Chat
Social:  Say Hello | Anything Goes | Shares

Get a random digits from array of int (CS Program)

Lottery Programs coded in CodeSkulptor
Forum rules
This forum is now locked.
Please visit The Lottery Forum (New)
Locked
tim
GL Blogger

Get a random digits from array of int (CS Program)

Post#1 by tim » 18 Mar 2019, 18:54


The method is described here.
This is a variation built on top of what was described in above link.
This random decimals digits CS program
allows you specify min length to return a seemingly random string of digits (which you can use as pseudo-random numbers).

Statistically prove at the end to show that the numbers are distributed evenly too.

code for reference:

Code: Select all

import math
def decimals(arr,minlength):
    n = 1
    for a in arr:
        n *= a
        t = n
    #n is product of all numbers    
    s = ""
    while len(s)<minlength:
        log = math.log(n)
        log = str(log)
        decimal = log[log.find(".")+1:]
        n = t*int(decimal)  #n multiplied by whatever decimal is
        s += decimal
    return s

mydec = decimals([9,10,27,39,43,1],1000)
print (mydec)
counts = []
# See if it's statistically random or not
for i in range(0,10):
    count = mydec.count(str(i))
    counts.append(count)
print ("tallies:",counts,"sum:",sum(counts),"average:",sum(counts)/len(counts))
Data output result of above program:

Code: Select all

2204082982733985676393699346387859516181168281739099208205393572467471798252314530489391761230391027557326937966191683909281100315115823673568311624215766684671270160919075667814149271100934426807187733948621153979667843055844003302669553323503012296046984778176960811272046734522299193772430381819599357542290478463430574548844994195297409423610892048175342421266054728788315726645061822633646277348617315655944927001022358195327801570769702507721385604635662667268187284169599477133775299866302989302142548713337964108529086102552216085780510749698166178888696110211263050771177204176451580655595842357526708808536490208939181432175683302868879805180392198338469752295043432774425903199062593382368409488805892762903045463437547421255964880084421050777796880265512872331378210967332170360100936922303226116537799724467376951378904664264963597491809639741608063423418704747237566996662044755183383710870645420191505820419756468565366747731601852880524408712342168058297015030376380875216930829614653916
tallies: [100, 100, 104, 104, 90, 90, 111, 106, 101, 97] sum: 1003 average: 100.3
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
0


TLF Topics: Active | Unanswered | Random
TLF Posts: Unread | New | Random
Lottery Forum
     Lottery/General Program Requests | Lottery Generators |🡆 Lottery CodeSkulptor Programs
     General Programs
     Chit Chat
Social:  Say Hello | Anything Goes | Shares

Locked
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 2 guests