Author Topic: [Java] Number generator  (Read 6839 times)

0 Members and 1 Guest are viewing this topic.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
[Java] Number generator
« on: 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

Code: [Select]
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"); }
        }

        }
   
     }
}

}

Offline MR.Dug

  • NULL
  • Posts: 3
  • Cookies: -8
    • View Profile
Re: [Java] Number generator
« Reply #1 on: September 16, 2012, 01:13:39 am »
what the fuck does any of this mean

Offline puddi

  • Voted Best Avatar
  • VIP
  • Royal Highness
  • *
  • Posts: 662
  • Cookies: -2074
  • Stop being a fag today!Join #puddimasterrace @ IRC
    • View Profile
Re: [Java] Number generator
« Reply #2 on: 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:
Code: [Select]
        for (int CountY = 1; CountY <= Y; CountY++) {can trick almost any server. a vulnerability i cant believe no one has patched! >:O
« Last Edit: September 16, 2012, 01:25:45 am by Professor Potato »

Do you got a cool story you would like to share bro?

The following users thanked this post: puddi

Offline s3my0n

  • Knight
  • **
  • Posts: 276
  • Cookies: 58
    • View Profile
    • ::1
Re: [Java] Number generator
« Reply #3 on: September 16, 2012, 07:48:49 am »
now this shit right here:
Code: [Select]
        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
Easter egg in all *nix systems: E(){ E|E& };E

Offline Chronic x

  • Peasant
  • *
  • Posts: 91
  • Cookies: 24
  • Former GMOD.
    • View Profile
Re: [Java] Number generator
« Reply #4 on: 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.
« Last Edit: September 16, 2012, 07:55:54 am by Chronic x »
Can't Stop The Crooks

Offline Daemon

  • VIP
  • Baron
  • *
  • Posts: 845
  • Cookies: 153
  • A wise man fears a gentle mans anger
    • View Profile
Re: [Java] Number generator
« Reply #5 on: 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 :)
This lifestyle is strictly DIY or GTFO - lucid

Because sexploits are for h0edays - noncetonic


Xires burns the souls of HF skids as a power supply

Offline p_2001

  • Royal Highness
  • ****
  • Posts: 684
  • Cookies: -64
    • View Profile
Re: [Java] Number generator
« Reply #6 on: 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.
"Always have a plan"

Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Re: [Java] Number generator
« Reply #7 on: 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.
>>>import this
-----------------------------

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: [Java] Number generator
« Reply #8 on: 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.

Offline p_2001

  • Royal Highness
  • ****
  • Posts: 684
  • Cookies: -64
    • View Profile
Re: [Java] Number generator
« Reply #9 on: 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.
« Last Edit: September 17, 2012, 03:24:56 pm by p_2001 »
"Always have a plan"

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: [Java] Number generator
« Reply #10 on: 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).

Offline p_2001

  • Royal Highness
  • ****
  • Posts: 684
  • Cookies: -64
    • View Profile
Re: [Java] Number generator
« Reply #11 on: 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..
"Always have a plan"

Offline Deque

  • P.I.N.N.
  • Global Moderator
  • Overlord
  • *
  • Posts: 1203
  • Cookies: 518
  • Programmer, Malware Analyst
    • View Profile
Re: [Java] Number generator
« Reply #12 on: 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.