473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

rnd() not so random?

BSOB
77
ok, we've all used random, and if we've used it enough we've figured out that it is infact a predictable function. and honestly, i was ok with that. until i realized that the rnd function's quazi-frequency happens to be the width of my screen. which happens to be an issue.
1) does anyone know what im talking about?
2) does anyone know of a good way to make a random number that doesnt have a steady frequency?

if people dont know what im talking about:
make a fullscreen form with borderstyle = 0.

private sub form_click()
dim shade as byte
for y = 0 to screen.height
for x = 0 to screen.width
shade = rnd*256
pset(x,y), rgb(shade,shade,shade)
next x
doevents
next y
end sub

and clean your glasses, they might just be scratched.
Aug 3 '06 #1
4 3187
danp129
323 Expert 256MB
not sure what I should look for, I saw what looked like a TV with no signal. Have you tried using Randomize (timer) at the beginning of your code?
Aug 3 '06 #2
Wrycu
9
Rnd isnt random. Think about it. How could it be? Everything here is coded in. But, as the other person said, if you add Randomize (right before rnd is good), it kills the pattern and the same order the 'random' numbers come up in.
Sep 5 '06 #3
i got told once that the start random number was based on the time and date of the computer (down to the second) so its hard to get the random sequence to run again, but i have often thought the same, how random IS randomize ona computer? and i find that RANDOMIZE at the start of the code (either on load or on click (which ever u want) it tends to garuntee a random number
Sep 6 '06 #4
Wrycu
9
It cant be random. At least, not truely random. It cannot chose which to pick, it has to be coded in. So, it says...
rnd =
.1343
.453342
.423
.85654
.45634
.1433
.3453
etc
and every time you run it, you get those numbers in that order.
Randomize makes it more random. I dunno how, it probably has some complex thingy that makes it.. more random. or at least, makes it seem random. and as long as it seems random, who cares if it is?
Sep 7 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Andrew Banks | last post by:
I'm trying to order a recordset randomly. I've tried the following ORDER BY Rnd(ProdID) - ProdID is my primary key I've read that this will be random but will always return the same random...
1
by: Leslie | last post by:
I need to get 20 random records from a table based on a condition. The condition isn't a problem. I have tried select top 20 *, rnd(field) from table, but that gets me the top 20 records. I need...
0
by: Howard Kaikow | last post by:
I can seed Randomize to assure that I get the same sequence, using Rnd each time. I can seed Random to assure that I get the same sequence, using Next, each time. Is there any way to seed...
5
by: V Power | last post by:
Hi, I have just been putting together a random number generator to practice with VB .NET. The Rnd command on its own works fine, however as soon as I add = 10 to the string I get a return value...
11
by: bogusexception | last post by:
(or.. "I'm getting too much Tails and not enough Heads") I'm running into a very strange problem with random numbers and long numbers. To demonstrate the problem, I've created a simple test....
1
by: Radu | last post by:
As simple-to-remember-but-unique confirmation numbers, I need to generate six random characters (ASCII 65 to 90, inclusive): Randomize() objStringBuilder.Append(Chr(CInt(Int((25 * Rnd()) +...
2
by: McKirahan | last post by:
Can someone show me the JavaScript equivalent to the following VBScript? Thanks in advance. Randomize For i = 0 to 15 intRnd = Int((16 * Rnd) + 1) Next Perhaps the follwoing is a start?
8
by: zaankanter | last post by:
Hi, This is my problem. A form (startform) is opened, wich is based on a table, called programvariables. This is supposed to be a one-record table, wich will hold some values needed to store...
13
by: Nick | last post by:
Hi there, I'm trying to create a random number via a seed in VB.NET and C++, 2 different applications. I want to be able to use the same seed and get the same random number but unfortunately...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.