EvilZone

Programming and Scripting => Java => : Kulverstukas September 20, 2011, 04:58:01 PM

: [Java] Number generator
: Kulverstukas September 20, 2011, 04:58:01 PM
Script to generate a table of random integers of given length on X and Y dimensions, so 4x4 would produce:

11 11 11 11
11 11 11 11
11 11 11 11
11 11 11 11

http://newage.ql.lt/projects/java/NumberGen.java (http://newage.ql.lt/projects/java/NumberGen.java)

:
package NumberGen;

import java.util.Random;

/**
 *
 * author Kulverstukas
 * Written on: 2011.09.20
 * http://newage.ql.lt/
 * Evilzone.org
 * ----
 * Generates a XxY square of random numbers
 * of given length in X and Y.
 *
 */

public class NumberGen {

public static void PrntHlp() {
System.out.println(" Usage:\n" +
           "\tNumberGen N X Y\n" +
           "\tWhere N is a number of numbers\n" +
           "\tand X is a number on X axis\n" +
           "\tand Y is an number on Y axis.\n" +
           "\t\tExample: NumberGen 5 5\n");
}

public static void main(String[] args) {

    PrntHlp();
        if (args.length <= 1 ) { System.out.println("\nNot enough args given!"); }
        else if (args.length >= 2) {
        int X = Integer.parseInt(args[0]);
        int Y = Integer.parseInt(args[1]);
        Random Rand = new Random();
        for (int CountY = 1; CountY <= Y; CountY++) {
        for (int CountX = 1; CountX <= X; CountX++) {
            System.out.print((Rand.nextInt(89)+10)+" ");
            if (CountX == X) { System.out.print("\n"); }
        }

        }
   
     }
}

}
: Re: [Java] Number generator
: MR.Dug September 16, 2012, 01:13:39 AM
what the fuck does any of this mean
: Re: [Java] Number generator
: puddi September 16, 2012, 01:24:37 AM
what the fuck does any of this mean
this generates random numbers. aka if you were to shop at amazon for an item, with this tool you can at any time change the final price before purchasing. which means you can buy shit worth $1k for a piece of shit dollar but be careful though i suggest you use tor for maximum anonymity.

now this shit right here:
:
        for (int CountY = 1; CountY <= Y; CountY++) {can trick almost any server. a vulnerability i cant believe no one has patched! >:O
: Re: [Java] Number generator
: s3my0n September 16, 2012, 07:48:49 AM
now this shit right here:
:
        for (int CountY = 1; CountY <= Y; CountY++) {can trick almost any server. a vulnerability i cant believe no one has patched! >:O

Why do you have -922 karma XD
: Re: [Java] Number generator
: Chronic x September 16, 2012, 07:55:00 AM
Actually, Number generators can be used in gambling, statistical sampling, computer simulation, cryptography and more, anywhere really where random numbers are desirable. It's kinda like a virtual dice, but bigger.
: Re: [Java] Number generator
: Daemon September 16, 2012, 11:33:28 PM
I also use random number generator's for games, like if making a text based RPG for class or something similar i would have a bunch of instances for each level and depending on what number the generator created it would load that instance. That way nothing loads the same every time, which makes the game a little less predictable IMO. Anytime you don't want things predictable, consider using a random number generator to just add a little more fun to it :)
: Re: [Java] Number generator
: p_2001 September 17, 2012, 05:01:59 AM
Actually, Number generators can be used in gambling, statistical sampling, computer simulation, cryptography and more, anywhere really where random numbers are desirable. It's kinda like a virtual dice, but bigger.

Um.. In gambling?
Number Gen. are predictable.. You know that right?
I don't think they can be used in proper gambling.
: Re: [Java] Number generator
: techb September 17, 2012, 05:21:38 AM
I like Puddi's answer the best lol.

On a side note, the original thread was from 2011, read the dates MR.Dug, your posts are getting a touch annoying. Further no-nos might end up with a temporary ban, this is a warning.
: Re: [Java] Number generator
: Deque September 17, 2012, 03:15:00 PM
Um.. In gambling?
Number Gen. are predictable.. You know that right?
I don't think they can be used in proper gambling.

Slot machines use randomly generated numbers. How do you think the numbers are produced? Of course it shouldn't be a generator that is easily predictable, but nevertheless you need a number generator.
: Re: [Java] Number generator
: p_2001 September 17, 2012, 03:24:30 PM
Slot machines use randomly generated numbers. How do you think the numbers are produced? Of course it shouldn't be a generator that is easily predictable, but nevertheless you need a number generator.

I thought it was some sort of hardware, like a pressure gauge, the least count of whose can be used as a random number seed. Our maybe something to measure vibrations... With so many people the noise can be used to generate random number or pass the noise as seed.
: Re: [Java] Number generator
: Deque September 17, 2012, 03:30:55 PM
It doesn't matter if it is hardware or software based. It is still a number generator.
But yes, using noise, radioactivity or similar you are able to produce true random numbers (instead of pseudorandom ones).
: Re: [Java] Number generator
: p_2001 September 17, 2012, 04:42:57 PM
It doesn't matter if it is hardware or software based. It is still a number generator.
But yes, using noise, radioactivity or similar you are able to produce true random numbers (instead of pseudorandom ones).

I believe my question was wrongly phrased.
I meant the random generator used by languages, that is the pseudo random generator.
That cannot be used can it?
It probably seeds by the time..
: Re: [Java] Number generator
: Deque September 18, 2012, 09:15:04 AM
I believe my question was wrongly phrased.
I meant the random generator used by languages, that is the pseudo random generator.
That cannot be used can it?
It probably seeds by the time..

It can be used, there are secure pseudorandom generators which are also used in cryptography. Their number output is that similar to true random numbers that predicting the next number is impossible in a reasonable time.

https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator

They do not have to use the time as seed. They may also use keyboard and mouse input or similar.

Random generators that produce true random numbers usually do not need a seed.