Lying online numbers

Maljonic

Can't get enough of FH
Joined
Dec 22, 2003
Messages
1,297
Okay I've made this little dating site and it always says 410 people online, which looks pretty stupid; it there a little script I can use to make the number move up and down so it looks active? :)
 

sibanac

Fledgling Freddie
Joined
Dec 19, 2003
Messages
824
just put the real number and add a random offset to it
say real + (random(between 20 and 30)

recalculate every time the page is loaded
 

Maljonic

Can't get enough of FH
Joined
Dec 22, 2003
Messages
1,297
There is no real number, it's all lies lies lies; but just say I wanted it to be around 400 plus or minus whatever, how would I write that? :)
 

sibanac

Fledgling Freddie
Joined
Dec 19, 2003
Messages
824
Maljonic said:
There is no real number, it's all lies lies lies; but just say I wanted it to be around 400 plus or minus whatever, how would I write that? :)
depends on what lang you are using for the rest of the page :)
 

Maljonic

Can't get enough of FH
Joined
Dec 22, 2003
Messages
1,297
I was thinking a simple javascript type scenario. :)
 

sibanac

Fledgling Freddie
Joined
Dec 19, 2003
Messages
824
Maljonic said:
I was thinking a simple javascript type scenario. :)
I am not much of a JS coder but this should kinde do the trick


Code:
<script language="JavaScript">
random_num = (Math.round((Math.random()*9)+400))
document.write(random_num);
</script>
[code]



Math.random() generates a random number between 0 and 1
it then gets multiplyed by 9 and rounded to an integer value giving a result between 0 and 9
the + 400 adds the 0-9 to 400 resulting in a value between 400 and 409


the randomizer isnt seeded so the results might not be all that random (dunno if JS seeds automaticly or not )
 

Maljonic

Can't get enough of FH
Joined
Dec 22, 2003
Messages
1,297
Cheers that's perfect! Have a look at my little dating site so far, see the amazing counter move. I was thinking of maybe putting a * next to the online number with a disclaimer at the bottom, *could be lies. :)
 

Users who are viewing this thread

Top Bottom