Wracking my brain
BlitzMax Forums/BlitzMax Programming/Wracking my brain You need to use parentheses if you're returning a value - no way around that.
You got me there.
Any reason why Rand(50,100) is unsuitable?
Any reason why Rand(50,100) is unsuitable?
If I do a Rand(50,100) then the number will most definitely fall between those 2 numbers. If I do a Rand(1,100) and limit the result to 50 through 100 then 50 will come up 50% of the time...which is what I'm aiming for.
A simple If statement would work. But it's like when you can't remember the name to a movie or book you saw or read many years ago and it's bugging me. I'm googling it. If you find it before I do...
A simple If statement would work. But it's like when you can't remember the name to a movie or book you saw or read many years ago and it's bugging me. I'm googling it. If you find it before I do...
this = rand(1,100) if this < 50 then this = 50 'or this = rand(1,100) > 50 & blah blah (can't remember)
a = Rand(0,50) + 50
?
[edit] Nevermind, after reading your post above I can see that's not what you want.
?
[edit] Nevermind, after reading your post above I can see that's not what you want.
I'm shooting for it all on one line. ><
Max(50,Rand(100))
Max(50,Rand(100))
Heh, just looked at that and couldn't figure out how to use it.In my defence, its nearly 5am. :s
Am I the only one who suspects we still don't know the real question?
It sounds like he wants to choose a number from {50,51,52,... 100} with 50 occurring 50% of the time and all other numbers 1%.
But I can't think of a reason to want such a thing.
It sounds like he wants to choose a number from {50,51,52,... 100} with 50 occurring 50% of the time and all other numbers 1%.
But I can't think of a reason to want such a thing.
Floyd...you can talk directly to me, i don't bite. =p
The number selected may be from 1 to 100. But...if the number is 49 or below then the number returned will be 50. But I know there's a way to use the > or & symbol to do it instead of using IF...THEN.
It's just a matter of doing it all on one line.
It's kinda like doing a stunt on your dirtbike and impressing the ladies!
The number selected may be from 1 to 100. But...if the number is 49 or below then the number returned will be 50. But I know there's a way to use the > or & symbol to do it instead of using IF...THEN.
It's just a matter of doing it all on one line.
It's kinda like doing a stunt on your dirtbike and impressing the ladies!
Skidracer nailed it...but I know there's still a way to do it with > or &.
Do it in Blitz3D!
Do it in Blitz3D!
Okay. Well, the 50+rand(0,1)*Rand(50) suggestion works in Blitz3D.
Nah, I've seen someone do it in Blitz3D...I just can't remember how it was done.
Or...what I saw in Blitz3D might not be the same as what I'm trying to do...that's the sad part, I can't remember.
Or...what I saw in Blitz3D might not be the same as what I'm trying to do...that's the sad part, I can't remember.
you could do
Rand(2)*Rand(1,50) + 50
if what you want is one line.
Rand(2)*Rand(1,50) + 50
if what you want is one line.
Now I have done
If Rand(1,4) > 1 then DoSomething()
to make sure that DoSomething is called 75% of the time. Is this perhaps what you've seen?
If Rand(1,4) > 1 then DoSomething()
to make sure that DoSomething is called 75% of the time. Is this perhaps what you've seen?