GoGreen PC TuneUp™
Learn More

Insta-Install™
this is how we code sign our software and ssl encrypt our websites from our affiliate partner SSL.com

myBlog

myBlog Home

Back to Blog List View Table View MTNCOMP


check randomness function

by Mountain Computers Inc., Publication Date: Thursday, December 20, 2018
View Count: 396, Keywords: random, function, vb.net, Hashtags: #random #function #vb.net



i was trying to randomly walk a 156GB database and randomly go through millions and millions of records, so I decided to see if you this randomness function would work without salting the rnd generator, it worked... , given an upper bound, my upper bound row id was 1526763840.. so try this.. 
 
        'check randomness function
        Debug.Print("randomness function test")
        Dim r
        Dim x
        For x = 1 To 1000
            r = CInt(Math.Ceiling(Rnd() * 1526763840) + 1)
            Debug.Print(x & vbTab & r)
        Next
 
 correction: use this in place of the r = line above
 
 
            'r = CInt(Math.Ceiling(Rnd() * maxDBrecords) + 1)
            Static Generator As System.Random = New System.Random()
            r = Generator.Next(1, maxDBrecords)
            'as long as r is within bounds
 
 
 
more to come.

if you found this article helpful, consider contributing $10, 20 an Andrew Jackson or so..to the author. more authors coming soon
FYI we use paypal or patreon, patreon has 3x the transaction fees, so we don't, not yet.

© 2021 myBlog™ v1.1 All rights reserved. We count views as reads, so let's not over think it.