Random Chance and Number Generator - Batch File Tool

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
3,630
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Dec 16, 2008

Script: http://ScrewTheLotOfYou.webs.com

A small program with two very useful functions.

It generates a random number within a chosen range or set the range in the code. It generates the number near-instantly, there is no delay or waiting as with most other batch random number generators.

The other function is is to generate a probability that you choose or can be set in the script. You can set the program to return a positive response for any probability possible for example 1 in 10, 1 in 3, 99 out of 100 etc.

Not a very useful program in its own right, but the functions are very useful for any programming not limited to batch programs/systems.

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (ScrewTheLotOfYou)

  • I made a "guess the number" game. But i use %random% to get the number.. how do i set a range from like 1-150? can you even do that? please help. Not from a begining coder either. somebody who knows what they are saying

  • Yes you can, to generate a number from 1-150 in a batch file do this:

    set /a RandomNumber= %random% %% 150 + 1

  • Awesome Video 5/5

    Also I downloaded a most of your batch files off your site. They're beast!!

    One question though. How do you find enough time to right them, and how do you know all those more complex codes?

  • Thank you! :D

    Believe it or not it doesn't take that long to write them! In general it'll take a week to write one from scratch. I only write them at nights after a day working.

    I don't know any special codes, it's all standard batch code. I just try lots of different things :)

  • great video, you really are skilled with batch

  • Thanks very much! :)

see all

All Comments (21)

Sign In or Sign Up now to post a comment!
  • :RC1

    cls

    echo Good Luck!

    set /a chanceVar= %random% %% %3%

    set /p chanceVar= %random% %% %2%

    if /i %chanceVar% lss %2% goto You Win

    if /i %chanceVar% lss %1% goto You Win

    if /i %chanceVar% lss %3% goto You Lose

    this is the code I have but it always goes to you win did i do something wrong? if you can, plz try it out

  • @ScrewTheLotOfYou Wher did you learn batch? Please answer quickly!!

  • Hey man, thanks for the tutorial. I think it's cool how you have your own website and everything where you've made some games. But anyway, I used your random number generation to help me in this game I'm making called Dwarven Seige. I used the number generator to estimate critical strikes in battle.

  • is there any way to make a batch file type on other things besides the cmd? like if iw anted it to type google it could do that :o?

  • Fuu, no matter what I write, it says either "Enter numerator" or "Enter the minimum value the number can take"

  • SUBSCRIBE! :D

  • I'm gonna use this as a map generator in a video game mod :)

    I'm also making a random maze generator too, again this is useful.

  • @ScrewTheLotOfYou give me code

  • @ScrewTheLotOfYou Thank you very much! I'm going to make a tic tac toe batch file game and then i need

    to know if naught's or cross' start :)

  • 2:38 u skipped a 1

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more