the_lord_mephy Posted October 14, 2004 Posted October 14, 2004 Is there a way to get a random line from a text file? My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Valik Posted October 14, 2004 Posted October 14, 2004 Nope, none at all. Its not like this is a scripting language capable of advanced tasks or anything. Honestly, was this "Ask question before thinking" day? I've just read half a dozen posts (Including another by the author of this thread) and if the authors would just think for two minutes about their question, they'd realize the answer instead of running off to the forum. Is thinking taboo?
the_lord_mephy Posted October 14, 2004 Author Posted October 14, 2004 thanks valik, *sigh* My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
ezzetabi Posted October 15, 2004 Posted October 15, 2004 (edited) Deja vu?http://www.autoitscript.com/forum/index.php?showtopic=5354 Last post.Edit: ahahaha, it is indeed non thinking day, the_lord_mephy it self answers in this other thread so he (she?) should know that exist... Wow. Edited October 15, 2004 by ezzetabi
the_lord_mephy Posted October 15, 2004 Author Posted October 15, 2004 icic, ok here comes another question. is there a way to find the ammount of lines in a text file? My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Developers Jos Posted October 15, 2004 Developers Posted October 15, 2004 icic, ok here comes another question. is there a way to find the ammount of lines in a text file?<{POST_SNAPBACK}>#include <file.au3>$cnt = _FileCountLines( $sFilePath ) SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past.Â
the_lord_mephy Posted October 15, 2004 Author Posted October 15, 2004 and now for the final question. =-o can i make it so the random number is always an integer? My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
emmanuel Posted October 15, 2004 Posted October 15, 2004 and now for the final question. =-o can i make it so the random number is always an integer?<{POST_SNAPBACK}>if only there were a function that returned an integer... that'd be great. "I'm not even supposed to be here today!" -Dante (Hicks)
Developers Jos Posted October 15, 2004 Developers Posted October 15, 2004 can i make it so the random number is always an integer?<{POST_SNAPBACK}>F1 (open the helpfile from your editor)... click on search.type IntegerHit Enter..Make an educated guess which function would be the best option.try it.... SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past.Â
ezzetabi Posted October 15, 2004 Posted October 15, 2004 RTFM $min = 1 $max = 100 Int(Random($min, $max + 1))
the_lord_mephy Posted October 15, 2004 Author Posted October 15, 2004 omg lol i asked three very dumb questions in a row, thanks guys My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Guest BL@(K-R34P3R Posted October 16, 2004 Posted October 16, 2004 Hey Jon, future suggestion. Make a random function like that of Java. It can randomly generate numbers between a given range. I was making a script for Java with that earlier today.
Valik Posted October 16, 2004 Posted October 16, 2004 Hey Jon, future suggestion. Make a random function like that of Java. It can randomly generate numbers between a given range. I was making a script for Java with that earlier today.<{POST_SNAPBACK}>How does Java's differ from the current random function?
ezzetabi Posted October 16, 2004 Posted October 16, 2004 You can even set max and min, you can also nest it inside a Int(). Really impressive.
Guest BL@(K-R34P3R Posted October 16, 2004 Posted October 16, 2004 Ya, what ezzetabi said. It actually choses a random number.
Matt @ MPCS Posted October 17, 2004 Posted October 17, 2004 Black, are you braindead today or is it a reoccurring tragedy? ezzetabi was refering to AutoIt not java. It may hurt but you should consider thinking before you post anything. *** Matt @ MPCS
the_lord_mephy Posted October 18, 2004 Author Posted October 18, 2004 lol. Matt, next to Valik you are one of the funniest people on this forum . Ah but Valik, he just has so many quotes, you still need some work My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Guest BL@(K-R34P3R Posted October 18, 2004 Posted October 18, 2004 No, if you know Java look at the random funciton. It takes in int's parameters... Like 10 -20 and will chose a random number between them.
Valik Posted October 18, 2004 Posted October 18, 2004 Whats your point? That's functionally identical to: Int(Random(10, 20)) AutoIt returns floating pointer numbers by default. If you want an Int, tell it to give you an Int by casting it to one.
Guest BL@(K-R34P3R Posted October 18, 2004 Posted October 18, 2004 I know that... I already learned that the AutoIt random function does that after posting my first thing.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now