Mercurial Hosting > luan
changeset 246:58752e3e4c5c
rename String.from_integers to char;
fix Math.random();
git-svn-id: https://luan-java.googlecode.com/svn/trunk@247 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 10 Oct 2014 02:23:19 +0000 |
parents | 2ed8465a9d62 |
children | b5995d77878a |
files | core/src/luan/modules/MathLuan.java core/src/luan/modules/StringLuan.java dist/jars/luan-core-trunk.jar dist/jars/luan-logging-trunk.jar dist/jars/luan-lucene-trunk.jar dist/jars/luan-mail-trunk.jar dist/jars/luan-web-trunk.jar |
diffstat | 7 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
diff -r 2ed8465a9d62 -r 58752e3e4c5c core/src/luan/modules/MathLuan.java --- a/core/src/luan/modules/MathLuan.java Thu Oct 09 23:05:01 2014 +0000 +++ b/core/src/luan/modules/MathLuan.java Fri Oct 10 02:23:19 2014 +0000 @@ -131,7 +131,7 @@ return Math.random(); if( n==null ) return Math.floor(m*Math.random()) + 1; - return Math.floor((n-m)*Math.random()) + m; + return Math.floor((n-m+1)*Math.random()) + m; } public static double sin(double x) {
diff -r 2ed8465a9d62 -r 58752e3e4c5c core/src/luan/modules/StringLuan.java --- a/core/src/luan/modules/StringLuan.java Thu Oct 09 23:05:01 2014 +0000 +++ b/core/src/luan/modules/StringLuan.java Fri Oct 10 02:23:19 2014 +0000 @@ -19,7 +19,7 @@ try { add( module, "to_binary", String.class ); add( module, "to_integers", String.class ); - add( module, "from_integers", new int[0].getClass() ); + module.put( "char", new LuanJavaFunction(StringLuan.class.getMethod( "char_", new int[0].getClass() ),null) ); add( module, "find", String.class, String.class, Integer.class, Boolean.class ); add( module, "format", String.class, new Object[0].getClass() ); add( module, "gmatch", String.class, String.class ); @@ -90,7 +90,7 @@ return chars; } - public static String from_integers(int... chars) { + public static String char_(int... chars) { char[] a = new char[chars.length]; for( int i=0; i<chars.length; i++ ) { a[i] = (char)chars[i];
diff -r 2ed8465a9d62 -r 58752e3e4c5c dist/jars/luan-core-trunk.jar Binary file dist/jars/luan-core-trunk.jar has changed
diff -r 2ed8465a9d62 -r 58752e3e4c5c dist/jars/luan-logging-trunk.jar Binary file dist/jars/luan-logging-trunk.jar has changed
diff -r 2ed8465a9d62 -r 58752e3e4c5c dist/jars/luan-lucene-trunk.jar Binary file dist/jars/luan-lucene-trunk.jar has changed