You want something to happen one out of a thousand times.
Would you do this:
foobar = random(10000)
if foobar > 9990
Or this?
foobar = random(1000)
if foobar =1000
Programming question
Moderators: AArdvark, Ice Cream Jonsey
- Ice Cream Jonsey
- Posts: 30067
- Joined: Sat Apr 27, 2002 2:44 pm
- Location: Colorado
- Contact:
Programming question
the dark and gritty...Ice Cream Jonsey!
- Flack
- Posts: 9057
- Joined: Tue Nov 18, 2008 3:02 pm
- Location: Oklahoma
- Contact:
- pinback
- Posts: 17849
- Joined: Sat Apr 27, 2002 3:00 pm
- Contact:
- Ice Cream Jonsey
- Posts: 30067
- Joined: Sat Apr 27, 2002 2:44 pm
- Location: Colorado
- Contact:
Thanks. Not in Hugo it doesn't, Hugo is smart enough to interpret that how I wrote it, and that was what I was writing in before HURRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRpinback wrote:foobar = random(1000)
if foobar = 69
huhhhuhu
EDIT: In most languages "if foobar = 1000", as you had it, wouldn't work, because in most languages "random(1000)" would return a number from 0 to 999.
the dark and gritty...Ice Cream Jonsey!