Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
[FONT=Courier New][SIZE=2][COLOR=#5f9ea0][FONT=Courier New][SIZE=2][COLOR=#5f9ea0]
[B][SIZE=2][FONT=Courier New][COLOR=#5f9ea0]cls[/COLOR][/FONT][/SIZE][/B]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$Zahl[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][B][FONT=Courier New][SIZE=2][COLOR=#5f9ea0][FONT=Courier New][SIZE=2][COLOR=#5f9ea0][FONT=Courier New][SIZE=2][COLOR=#5f9ea0]New-Object[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/B][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] int[] 9999[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] ([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]0; [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]-le[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] 9998; [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]++)[/SIZE][/FONT]
[SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$Zahl[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]}[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] ([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]0; [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]-le[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] 9998; [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]++)[/SIZE][/FONT]
[SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$x[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$Zahl[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]][/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$y[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] random(0..9998)[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$Z[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$Zahl[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$y[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]][/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$Zahl[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$i[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$z[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$Zahl[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$y[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000][FONT=Courier New][SIZE=2][COLOR=#ff0000]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$x[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]}[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]$Zahl[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] | [/SIZE][/FONT][/SIZE][/FONT][B][FONT=Courier New][SIZE=2][COLOR=#5f9ea0][FONT=Courier New][SIZE=2][COLOR=#5f9ea0][FONT=Courier New][SIZE=2][COLOR=#5f9ea0]out-file[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/B][I][FONT=Courier New][SIZE=2][COLOR=#5f9ea0][FONT=Courier New][SIZE=2][COLOR=#5f9ea0][FONT=Courier New][SIZE=2][COLOR=#5f9ea0]-filepath[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/I][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]E:\Numbers.txt[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
Das kriegen wir doch kürzer:Ein wenig langweilig, aber doch schnell geschrieben in Shellscript (zsh getestet):
Code:for i in {0000..9999}; do echo $i; done| shuf > zahlen.txt
shuf -e {0000..9999} > zahlen.txt
sicher, dass die AusgabeCode:tr -dc 0-9 < /dev/urandom
entsprichtalle Zahlen von 0000 bis 9999
...
Bsp:
1234
2345
0001
9991
usw.
REPORT zrandom_numbers.
DATA: number(4) TYPE n,
tab_numb LIKE TABLE OF number,
seed TYPE i,
v_random TYPE REF TO cl_abap_random_int,
next_int TYPE i.
PARAMETERS: p_file TYPE string.
* Random - Generator anschmeißen:
seed = cl_abap_random=>seed( ).
v_random = cl_abap_random_int=>create( seed = seed min = 0000 max = 9999 ).
* Zufallszahlen rein
DO 9999 TIMES.
next_int = v_random->get_next( ).
number = next_int.
READ TABLE tab_numb WITH KEY table_line = number TRANSPORTING NO FIELDS.
IF sy-subrc IS NOT INITIAL.
APPEND number TO tab_numb.
ENDIF.
ENDDO.
* Ausgabe auf Bildschirm (und in Datei)
LOOP AT tab_numb into number.
WRITE: / Number.
ENDLOOP.
cl_gui_frontend_services=>gui_download(
EXPORTING
filename = p_file
CHANGING
data_tab = tab_numb ).
[COLOR=#008000][B]using[/B][/COLOR] System;
[COLOR=#008000][B]using[/B][/COLOR] System.Linq;
[COLOR=#008000][B]using[/B][/COLOR] System.IO;
[COLOR=#008000][B]namespace[/B][/COLOR] HaBo
{
[COLOR=#ff0000]class[/COLOR] RandomNumbers
{
[COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#a52a2a]static[/COLOR] [COLOR=#ff0000]void[/COLOR] [COLOR=#191970][B]Main[/B][/COLOR]([COLOR=#ff0000]string[/COLOR][] args)
{
File.[COLOR=#191970][B]WriteAllText[/B][/COLOR]([COLOR=#0000ff]"random.txt"[/COLOR],
String.[COLOR=#191970][B]Join[/B][/COLOR](Environment.NewLine,
Enumerable.[COLOR=#191970][B]Range[/B][/COLOR]([COLOR=#00008b]0[/COLOR], [COLOR=#00008b]10000[/COLOR])
.[COLOR=#191970][B]OrderBy[/B][/COLOR](x => Guid.[COLOR=#191970][B]NewGuid[/B][/COLOR]())
.[COLOR=#191970][B]Select[/B][/COLOR](s => s.[COLOR=#191970][B]ToString[/B][/COLOR]([COLOR=#0000ff]"D4"[/COLOR]))));
}
}
}
#include <fstream>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <array>
using namespace std;
//Compile with -c++0x, uses C++11 features
int main()
{
ofstream out("Test.txt");
array<int, 10000> ar;
for (int i = 0; i <= 9999; ++i)
ar[i] = i;
srand(unsigned(time(NULL)));
random_shuffle(ar.begin(), ar.end());
for (int i = 0; i <= 9999; ++i)
out << setfill('0') << setw(4) << ar[i] << '\n';
return 0;
}
#!/usr/bin/python
import random
counter = 0
zahlen = []
f=open("output.txt", "w")
while counter <= 9999:
counter = counter + 1
cache = str(counter)
if len(cache) == 1:
zahlen.append("000"+cache+"\n")
if len(cache) == 2:
zahlen.append("00"+cache+"\n")
if len(cache) == 3:
zahlen.append("0"+cache+"\n")
if len(cache) == 4:
zahlen.append(cache+"\n")
random.shuffle(zahlen)
x = 0
while x <= 9999:
f.write(zahlen[x])
x = x + 1
iimport java.io.FileWriter;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
public class Zufallszahlen {
/**
* @param args
*/
@SuppressWarnings("unchecked")
public static void main( String[] args ) {
//Variablen initialisiern
int random;
String srandom;
ArrayList<String> al = new ArrayList<String>();
ArrayList<String> al2;
FileWriter fw = null;
final String LINE_SEPARATOR = System.getProperty("line.separator");
while( al.size() < 10000 ) {
random = ( int )( ( Math.random() * 10000 + 1) );
DecimalFormat df = new DecimalFormat( "0000" );
srandom = df.format( random );
if( !al.contains( srandom ) ) {
al.add( srandom );
} else {
System.out.println("Gibt's schon");
}
}
al2=( ArrayList<String> )al.clone();
Collections.sort(al2);
try {
fw = new FileWriter("Zufall.txt");
System.out.println("Schreibe Zahlen in Datei 'Zufall.txt'");
for( int i=0; i < al.size(); i++ ) {
fw.write( al.get( i ) + " | " + al2.get( i ) + LINE_SEPARATOR);
}
System.out.println("Fertig!");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
fw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
import java.io.*;
import java.util.Random;
class ZahlenTXT {
public static void main(String[] args) throws IOException {
FileWriter fw = new FileWriter("zahlen.txt");
BufferedWriter bw = new BufferedWriter(fw);
Random rand = new Random();
int array[] = new int [10000];
StringBuffer zahl = new StringBuffer();
String ausgabe = "";
int zaehler = 0;
int zufallszahl;
for (int i=0; i < 10000; i++) {
schleife:
while (true) {
zufallszahl = rand.nextInt(10000);
for (int j=0; j <= zaehler; j++) {
if (zufallszahl == array[j]) {
break schleife;
}
}
if (zufallszahl < 10) {
zahl.append("000" + zufallszahl);
} else if (zufallszahl < 100) {
zahl.append("00" + zufallszahl);
} else if (zufallszahl < 1000) {
zahl.append("0" + zufallszahl);
} else {
zahl.append(zufallszahl);
}
array[zaehler] = zufallszahl;
zaehler++;
ausgabe = zahl.toString();
bw.write(ausgabe);
bw.newLine();
System.out.println(zahl);
zahl.setLength(0);
continue schleife;
}
}
bw.close();
}
}
#!/usr/bin/python
# -*- coding: utf-8 -*- om
import os
import sys
import random
oberegrenze = int(raw_input("Geben Sie eine Obergrenze fuer die Zufallszahlen ein: "))
for i in range (10):
x = random.random ()
x = x * oberegrenze
if int (x) == 0:
x = 1
print int (x)
Es ging um alle Zahlen von 0000 bis 9999 in zufälliger Reihenfolge, nicht 10 ZahlenCode:oberegrenze = int(raw_input("Geben Sie eine Obergrenze fuer die Zufallszahlen ein: ")) for i in range (10): x = random.random () x = x * oberegrenze if int (x) == 0: x = 1 print int (x)
seq -w 0 9999|sort -R > output
man sort hat gesagt.:-R, --random-sort, --sort=random
Sort by a random order. This is a random permutation of the
inputs except that the equal keys sort together. It is imple‐
mented by hashing the input keys and sorting the hash values.
The hash function is chosen randomly. The hash function is ran‐
domized by /dev/random content